Soap Service – Source Reference
The Soap Service <SoapService> element is used to call a SOAP based web service. It can be created in the graphical editor by drag&drop a WSDL file into the editor. This will open a dialog that allows you to select the operation to execute. The Soap Service element does not need the WSDL file. All necessary information is created from the WSDL file and kept in the element itself. The request/response data structure is represented similar to a Component element and field values, expected values and verify expressions can be defined in same way as for a Component.
Syntax
The syntax of the Soap Service element is:
namespaceUri="<namespace>"
operationName="<operationname>"
qualifyData="true|false">
<Authentication type="Basic" userId="user" />
<HttpHeaders>
<Header key="<key>" value="<value>" />
</HttpHeaders>
<Request> data
itemsÖ
</Request>
<Response>
data items…
</Response>
</SoapService>
Required data is:
- endpointUri: Uri to the server hosting the web service
- namespaceUri: Namespace of the operation to execute
- operationName: Operation to execute
- qualifyData: If true, the operation namespace will be added to all data elements in the request message. Default is false.
If the web service uses HTTP Basic authorization, then an Authentication element must be available under the Soap Service element where the userId is also specified. The password will be collected and saved by the client or server in a secure way, and it will not be part of the test scenario itself.
Optional Http headers can be added to the request by using the HttpHeaders element. Authorization and HTTP headers can be set from the graphical UI. The qualifyData attribute is only accessible from the XML syntax.
Example
The below example shows a web service that retrieves information about a country. It requires HTTP Basic authorization.
endpointUri="http://34.223.232.19/WebServicesDemo/ws/countries”
namespaceUri="http://spring.io/guides/gs-producing-web-service"
operationName="getCountryRequest"
qualifyData="true">
<Authentication type="Basic" userId="user" />
<HttpHeaders>
<Header key="xxx" value="value" />
</HttpHeaders>
<Request>
<name>Spain</name>
</Request>
<Response>
<country>
<name />
<population />
<capital />
<currency />
</country>
</Response>
</SoapService>