system.ws.runWebService

Sepasoft MES Module Suite

system.ws.runWebService

system.ws.runWebService(configurationName)

Description

This will run a web service with the current parameter settings that are defined in the configuration.

Syntax

system.ws.runWebService(configurationName)

  • Parameters

String configurationName - The name of the Web Service Configuration to run.

  • Returns

A Web Service Variable object that represents the result of the Web Service.

  • Scope

All

Code Example

Python
result = system.ws.runWebService("Put_Article", {"id" : 1}, None, {"title" : "This is a title.", "text" : "This is a text."})
print result

Output

Code
{"Root": {
  "id": 1,
  "title": "This is a title.",
  "text": "This is a text."
}}

system.ws.runWebService(configurationName, bodyObject)

Description

This will run a web service with the current parameter settings that are defined in the configuration.

Syntax

system.ws.runWebService(configurationName, bodyObject)


  • Parameters

String configurationName - The name of the Web Service Configuration to run.

PyDictionary bodyObject - This will replace any parameters already defined by the configuration with a python object that will be used as the parameters of the web service. Using a python dictionary is recommended.

  • Returns

A Web Service Variable object that represents the result of the Web Service.

  • Scope

All

Code Example

Python
result = system.ws.runWebService("Put_Article", {"id" : 1}, None, {"title" : "This is a title.", "text" : "This is a text."})
print result

The first line gets the miles value from the Numeric Text Field component.

The second line calls the web service configuration and passes the miles value parameter. The fromLengthUnit and toLengthUnit parameters don't have to be passed here because they were defined in step 4. However, they can be passed here and it will override the values in the Measurement Conversion configuration. The body object parameter is a python object.

Line 3 read the kilometers value from the results. Because multiple values might exist in the results, this is done by name.

Line 4 converts the kilometer value to a string and puts it into the Numeric Label component.

system.ws.runWebService(configurationName, headersObject, bodyObject)

Description

This will run a web service with the current parameter settings that are defined in the configuration.

Syntax

system.ws.runWebService(configurationName, headersObject, bodyObject)

  • Parameters

String configurationName - The name of the Web Service Configuration to run.

PyDictionary headersObject - This will replace any headers already defined by the configuration with a python object that will be used as the headers of the web service. Using a python dictionary is recommended.

PyDictionary bodyObject - This will replace any parameters already defined by the configuration with a python object that will be used as the parameters of the web service. Using a python dictionary is recommended.

  • Returns

A Web Service Variable object that represents the result of the Web Service.

  • Scope

All

Code Examples

Code
result = system.ws.runWebService("Put_Article", {"id" : 1}, None, {"title" : "This is a title.", "text" : "This is a text."})
print result

Output

Code
{"Root": {
  "id": 1,
  "title": "This is a title.",
  "text": "This is a text."
}}

system.ws.runWebService(configurationName, urlParam, headersObject, bodyObject)

Description

This will run a web service with the current parameter settings that are defined in the configuration.

Syntax

system.ws.runWebService(configurationName, urlParams, headersObject, bodyObject)

  • Parameters

String configurationName - The name of the Web Service Configuration to run.

PyDictionary urlParam- This will replace the URL resource path or URL query string already defined by the configuration with a python object that will be used as the URL resource path or URL query string of the web service. Using a python dictionary is recommended.

PyDictionary headersObject - This will replace any headers already defined by the configuration with a python object that will be used as the headers of the web service. Using a python dictionary is recommended.

PyDictionary bodyObject - This will replace any parameters already defined by the configuration with a python object that will be used as the parameters of the web service. Using a python dictionary is recommended.

  • Returns

A Web Service Variable object that represents the result of the Web Service.

  • Scope

All

Code Examples

Code Snippet

Code
result = system.ws.runWebService("Put_Article", {"id" : 1}, None, {"title" : "This is a title.", "text" : "This is a text."})
print result

Output

Code
{"Root": {
  "id": 1,
  "title": "This is a title.",
  "text": "This is a text."
}}










Sepasoft MES Module Suite