WS Variable

Sepasoft MES Module Suite


The WSVariable object is returned from a web service call to hold the results of the call. This object contains references to child WSVariables that are defined in the schema of the output of the web service call.

Object Functions


addChild(index, child)

Description

Adds a new child to this ws variable.

Syntax

addChild(index, child)


  • Parameters

int index - The index for new child.

WSVariable child - The variable to add as a child to this WS variable.

  • Returns

Nothing

  • Scope

All

addChild(childElement)

Description

Adds and returns a new WSElement instance of childType to children.

Syntax

addChild(childElement)


  • Parameters

WSElement childElement - The web service element to be added as a child.

  • Returns

Nothing

  • Scope

All

addChild(child)

Description

Adds a new child object to this WS variable.

Syntax

addChild(child)


  • Parameters

WSVariable child - The WS variable to be added as child.

  • Returns

Nothing

  • Scope

All

clear()

Description

Removes this WS variable.

Syntax

clear()


  • Parameters

None

  • Returns

Nothing

  • Scope

All

copy()

Description

Creates an exact copy of the ws variable and also a copy of its children.

Syntax

copy()


  • Parameters

None

  • Returns

Returns the new copy of the WS variable.

  • Scope

All

getBindType()

Description

Gets the type of the bind of this WS variable.

Syntax

getBindType()


  • Parameters

None

  • Returns

BindType bindType - The bind type of this web service variable.

  • Scope

All

getChild(childElement)

Description

Returns the child of this WS variable.

Syntax

getChild(childElement)


  • Parameters

WSElement childElement - The WS element name to filter results.

  • Returns

The child of this WSVariable.

  • Scope

All

getChild(element, index)

Description

Returns the child of this WS variable.

Syntax

getChild(element, index)


  • Parameters

WSElement element - The WS element name to filter results.

int index - The index of child to return for.

  • Returns

The child of this WSVariable.

  • Scope

All

getChild(elementName, index)

Description

Returns the child of this WS variable.

Syntax

getChild(elementName, index)


  • Parameters

 int index - The index of child to return for.

String elementName - The children type to return for.

  • Returns

The child of this WSVariable.

  • Scope

All

getChild(index)

Description

Returns the child of this WSVariable specified by the index parameter.

Syntax

getChild(index)


  • Parameters

 int index - The index of child to return for.

  • Returns

The child of this WS variable with the given index.

  • Scope

All

getChild(name)

Description

Returns the WSVariable associated with this child name.

Syntax

getChild(name)


  • Parameters

 String childName - The name of the child to be returned.

  • Returns

WSVariable specified by the name parameter.

  • Scope

All

Example 1

Code Snippet

Code
wsVariable = system.ws.runWebService('Temperature Convert')
	resultData = wsVariable.getChild('FahrenheitToCelsiusResult')
	print  'value=%s' %(resultData.getValue() )

Example 2

Code Snippet

Code
wsVariable = system.ws.runWebService("rest2")
print wsVariable.getChild("numData")

Output

Code
{"numData": 100} 

toDataset()

Description


getChildCount()

Description

Gets the number of child elements contained by this WS variable. If it doesn't have a child, a count of zero is returned.

Syntax

getChildCount()


  • Parameters

 None

  • Returns

The number of children for this variable.

  • Scope

All

getChildInstances(element)

Description

Gets the child instances of the type specified by the WSElement.

Syntax

getChildInstances(element)


  • Parameters

WSElement element - The WS element object to filter the results.

  • Returns

List<WSVariable> The child instances associated with this WS variable.

  • Scope

All

getChildInstances(elementName)

Description

Gets the child instances of the type specified by the elementName parameter.

Syntax

getChildInstances(elementName)


  • Parameters

String elementName - The WS element name to filter the results.

  • Returns

List<WSVariable> The child instances associated with this WS variable.

  • Scope

All

getChildNames()

Description

Returns all child element names contained in this WSVariable.

Syntax

getChildNames()


  • Parameters

None

  • Returns

ArrayList<String> - The names of the children of this WSVariable.

  • Scope

All

getChildOccurrences(elementName)

Description

Returns the number of occurrences of the specified child.

Syntax

getChildOccurrences(elementName)


  • Parameters

String elementName - The name of the element to return the count for.

  • Returns

int count - The number of occurrences of the specified child.

  • Scope

All

getChildOccurrences(childElement)

Description

Returns the number of occurrences of the specified child element.

Syntax

getChildOccurrences(childElement)


  • Parameters

WSElement childElement - The child element to return the count for.

  • Returns

int count - The number of occurrences of the specified child element.

  • Scope

All

getChildren()

Description

Returns a list of children of this WS variable.

Syntax

getChildren()


  • Parameters

None

  • Returns

List<WSVariable> The list of children of this WS variable.

  • Scope

All

getElement()

Description

Returns a WSElement Object representing the schema element of the child.

Syntax

getElement()


  • Parameters

 None

  • Returns

WSElement - The WS element associated with this WS variable.

  • Scope

All

getExpression()

Description

Returns the expression set for binding property.

Syntax

getExpression()


  • Parameters

None

  • Returns

 Object expression - The expression set for this WS variable.

  • Scope

All

getHttpResponseHeaders()

Description

Returns the HTTP Response Headers associated with this WS variable.

Syntax

getHttpResponseHeaders()


  • Parameters

 None

  • Returns

PyDictionary - The HTTP Response Headers associated with this WS variable.

  • Scope

All

getName()

Description

Gets the name of this WS variable.

Syntax

getName()


  • Parameters

None

  • Returns

String name - The name of WS variable.

  • Scope

All

getParent()

Description

Gets the parent of this web service variable.

Syntax

getParent()


  • Parameters

None

  • Returns

 WSVariable parent - The parent corresponding to this WS variable.

  • Scope

All

getReasonPhrase()

Description

Get the reason phrase. 

Syntax

getReasonPhrase()


  • Parameters

None

  • Returns

String reasonPhrase - The corresponding reason phrase.

  • Scope

All

getResponseTime()

Description

Get the response time in milliseconds.

Syntax

getResponseTime()


  • Parameters

None

  • Returns

Long responseTime - The response time in milliseconds.

  • Scope

All

getStatusCode()

Description

Get the associated status code. 

Syntax

getStatusCode()


  • Parameters

None

  • Returns

int statusCode - The corresponding status code.

  • Scope

All

getValue()

Description

Returns an Object representing the value of the child. 

Syntax

getValue()


  • Parameters

None

  • Returns

Object value - The value of the child of this WSVariable.

  • Scope

All

hasChild(childElement)

Description

 Checks for the presence of child for the given web service element.

Syntax

hasChild(childElement)


  • Parameters

WSElement childElement - The WS element to check the existence of child for.

  • Returns

boolean - True, if there exist a child for the childElement and False otherwise.

  • Scope

All

hasChildren()

Description

 Checks if the web service element have children.

Syntax

hasChildren()


  • Parameters

WSElement childElement - The WS element to check the existence of child for.

  • Returns

boolean - True, if the WS element has children and False otherwise.

  • Scope

All

isArray()

Description

 This method returns true if this object represents an array class, else false.

Syntax

isArray()


  • Parameters

None

  • Returns

boolean - True, if the WS variable class is an array and False otherwise.

  • Scope

All

isBound()

Description

Boolean indicating that this WS variable is bound.

Syntax

isBound()


  • Parameters

None

  • Returns

boolean True, if the WS variable is bound and False otherwise.

  • Scope

All

isValid()

Description

Checks whether this WS variable is valid or not.

Syntax

isValid()


  • Parameters

None

  • Returns

boolean True if the WS variable is valid and False otherwise.

  • Scope

All

recordOrginalValues()

Description

Records the original values of the WS variable.

Syntax

recordOriginalValues()


  • Parameters

None

  • Returns

Nothing

  • Scope

All

removeChild(childElement)

Description

Removes the child from this WS variable.

Syntax

removeChild(childElement)


  • Parameters

WSElement childElement - The WS element to be removed.

  • Returns

Nothing

  • Scope

All

removeChild(childVariable)

Description

Removes the child from the WS Variable.

Syntax

removeChild(childVariable)


  • Parameters

WSVariable childVariable - The WS child variable to be removed.

  • Returns

Nothing

  • Scope

All

removeChild(index)

Description

Removes the child from the WS variable.

Syntax

removeChild(index)


  • Parameters

int index - The index of child to be removed.

  • Returns

Nothing

  • Scope

All

reset()

Description

Clears all the children and resets the value to the original value.

Syntax

reset()


  • Parameters

None

  • Returns

Nothing

  • Scope

All

setBindType(bindType)

Description

Sets the type of bind associated with this WS variable.

Syntax

setBindType(bindType)


  • Parameters

BindType bindType - The bind type to bound this WS variable.

  • Returns

Nothing

  • Scope

All

setChildren(children)

Description

Sets the children for this WS variable.

Syntax

setChildren(children)


  • Parameters

List<WSVariable> children - The list of WS variable to be set as children.

  • Returns

Nothing

  • Scope

All

setElement(element)

Description

Sets a WS element for this WS variable.

Syntax

setElement(element)


  • Parameters

WSElement element - The element set the WS variable for.

  • Returns

Nothing

  • Scope

All

setExpression(expression)

Description

Sets the expression for binding.

Syntax

setExpression(expression)


  • Parameters

Object expression - The expression to set the WS variable for.

  • Returns

Nothing

  • Scope

All

setName(name)

Description

Sets the name for the WS variable.

Syntax

setName(name)


  • Parameters

String name - The name to set the WS variable for.

  • Returns

Nothing

  • Scope

All

setParent(parent)

Description

Sets the parent for the WS variable.

Syntax

setParent(parent)


  • Parameters

WSVariable parent - The object to set the WS variable for.

  • Returns

Nothing

  • Scope

All

setValue(value)

Description

Sets the value for the WS variable.

Syntax

setValue(value)


  • Parameters

Object value - The value to set for the WS variable.

  • Returns

Nothing

  • Scope

All

toDataset()

Description

Converts a web service variable into a dataset.

Syntax

toDataset()


  • Parameters

 None

  • Returns

Dataset - A dataset representing the given Web Service Variable.

  • Scope

All

toDataset(expanded)

Description

Converts a web service variable into a dataset.

Syntax

toDataset(expanded)


  • Parameters

 boolean expanded - If set to 1 (true) then every child will be converted, if set to 0 then only the top level child will be converted.

  • Returns

Dataset - A dataset representing the given Web Service Variable.

  • Scope

All

toDict()

Description

Converts a web service variable into a python dictionary.

Syntax

toDict()


  • Parameters

 None

  • Returns

PyDictionary pyDict - A python dictionary representing the given Web Service Variable.

All

toExpandedDataset()

Description

Returns a Dataset Object representing the child values of the WSVariable and iterates through any children of the child values.

Syntax

toExpandedDataset()


  • Parameters

 None

  • Returns

Dataset - The dataset containing the child values of this WS variable.

  • Scope

All

toJSON()

Description

Converts a web service variable into a JSON.

Syntax

toJSON()


  • Parameters

 None

  • Returns

A JSON representing the given Web Service Variable.

  • Scope

All

toString()

Description

 Converts a web service variable into a String.

Syntax

toString()


  • Parameters

 None

  • Returns

A String representing the given Web Service Variable.

  • Scope

All

toXML()

Description

 Converts a web service variable into an XML.

Syntax

toXML(Boolean)


  • Parameters

 Boolean

  • Returns

An XML representing the given Web Service Variable.

  • Scope

All

Sepasoft MES Module Suite