SOAP Services

From DreamFactory
Jump to: navigation, search
Line 38: Line 38:
 
** '''mustunderstand''' - Boolean. Defaults to false. Value of the mustUnderstand attribute of the SOAP header element.
 
** '''mustunderstand''' - Boolean. Defaults to false. Value of the mustUnderstand attribute of the SOAP header element.
 
** '''actor''' - String. Optional. Value of the actor attribute of the SOAP header element.
 
** '''actor''' - String. Optional. Value of the actor attribute of the SOAP header element.
 +
 +
==Using SoapVar in Payloads==
 +
Sometimes the WSDL does not define every detail of a request payload, i.e. a request for multiple optional fields or objects.
 +
Starting with 2.5.1 (df-soap 0.8.1), this is supported by the use of the "soapvar" element.
 +
 +
<source lang="javascript">
 +
{
 +
"<field>": "<value>",
 +
"<field>": {
 +
"soapvar": {
 +
"type_name": "<object_name>",
 +
"type_namespace": "<object_namespace>",
 +
"node_name": "<outgoing_xml_node_name>",
 +
"node_namespace": "<outgoing_xml_node_namespace>",
 +
"data": {
 +
"<field>": "<value>",
 +
...
 +
}
 +
}
 +
}
 +
}
 +
</source
 +
 +
Where the elements contained in the '''soapvar''' are as follows
 +
* '''data''' - Required. Array, String, Integer, etc. The data array or scalar value to pass as the SoapVar to be encoded as directed.
 +
* '''encoding''' - Optional. String or Integer. The encoding ID, one of the XSD_ constants (i.e. XSD_STRING) or SOAP_ENC_ARRAY for arrays or objects.
 +
* '''type_name''' - Required. String. The object type name of the SOAP element to use.
 +
* '''type_namespace''' - Optional. String. The object type namespace of the SOAP element to use.
 +
* '''node_name''' - Optional. String. The XML node name to use when adding a scalar the the outgoing payload.
 +
* '''node_namespace''' - Optional. String. The XML node namespace to use when adding a scalar the the outgoing payload.
  
 
==Events==
 
==Events==
 
SOAP Services fire events based on the methods defined in the given WSDL file. For example,  
 
SOAP Services fire events based on the methods defined in the given WSDL file. For example,  
 
'''''myservice.call_method.post''''' would be generated for a call to POST '''''<nowiki>http://example.com/api/v2/myservice/call_method</nowiki>'''''.
 
'''''myservice.call_method.post''''' would be generated for a call to POST '''''<nowiki>http://example.com/api/v2/myservice/call_method</nowiki>'''''.

Revision as of 12:35, 23 March 2017

SOAP Services provide clients with REST-based access to XML-based SOAP remote services, taking much of the complexity out of the client access. DreamFactory takes care of converting the client request (JSON, etc.) to a SOAP request to the remote service, and the SOAP response to a easily consumed client response (JSON). DreamFactory takes the service's configured WSDL file and auto-generates a Live API service definition, determining available resources, required payloads, returned data types, and scriptable events.

Configuration

HTTP Services are managed via the api/v2/system/service API endpoint under the system service and have the service type of rws. The service type for information can be retrieved from here using the api/v2/system/service_type/rws endpoint.

Below is the format of a typical HTTP Service configuration.

{
	"id": 7,
	"name": "example",
	"label": "Example SOAP Service",
	"description": "",
	"is_active": true,
	"type": "soap",
	"mutable": true,
	"deletable": true,
	"created_date": "2016-07-15 13:04:56",
	"last_modified_date": "2016-07-19 19:23:06",
	"created_by_id": "1",
	"last_modified_by_id": "1",
	"config": {
		"wsdl": "http://example.com/ExampleService.wsdl",
		"options": null,
		"headers": null,
		"cache_enabled": true,
		"cache_ttl": 0
	}
}
  • wsdl - String. Required. WSDL URI is the location of the WSDL file describing the SOAP connection, or null if not available. This file could be on a remote site via URL or a local file.
  • options - Object/Associative Array. Required if wsdl set to null. Connection options containing name-value pair options for the connection. For further options, see http://php.net/manual/en/soapclient.soapclient.php.
  • headers - Array. Optional. An array of headers for the connection. For further info, see http://php.net/manual/en/class.soapheader.php.
    • type - Picklist of generic or wsse.
    • namespace - String. Required. The namespace of the SOAP header element.
    • name - String. Required. The name of the SoapHeader object.
    • data - String. Optional. A SOAP header's content. It can be a scalar value or an object.
    • mustunderstand - Boolean. Defaults to false. Value of the mustUnderstand attribute of the SOAP header element.
    • actor - String. Optional. Value of the actor attribute of the SOAP header element.

Using SoapVar in Payloads

Sometimes the WSDL does not define every detail of a request payload, i.e. a request for multiple optional fields or objects. Starting with 2.5.1 (df-soap 0.8.1), this is supported by the use of the "soapvar" element.

{
	"<field>": "<value>",
	"<field>": {
		"soapvar": {
			"type_name": "<object_name>",
			"type_namespace": "<object_namespace>",
			"node_name": "<outgoing_xml_node_name>",
			"node_namespace": "<outgoing_xml_node_namespace>",
			"data": {
				"<field>": "<value>",
				...
			}
		}
	}
}
</source
 
Where the elements contained in the '''soapvar''' are as follows
* '''data''' - Required. Array, String, Integer, etc. The data array or scalar value to pass as the SoapVar to be encoded as directed.
* '''encoding''' - Optional. String or Integer. The encoding ID, one of the XSD_ constants (i.e. XSD_STRING) or SOAP_ENC_ARRAY for arrays or objects.
* '''type_name''' - Required. String. The object type name of the SOAP element to use.
* '''type_namespace''' - Optional. String. The object type namespace of the SOAP element to use.
* '''node_name''' - Optional. String. The XML node name to use when adding a scalar the the outgoing payload.
* '''node_namespace''' - Optional. String. The XML node namespace to use when adding a scalar the the outgoing payload.
 
==Events==
SOAP Services fire events based on the methods defined in the given WSDL file. For example, 
'''''myservice.call_method.post''''' would be generated for a call to POST '''''<nowiki>http://example.com/api/v2/myservice/call_method</nowiki>'''''.