SOAP Connector

In Camunda Connect a Connectors class exists which automatically detects every connector in the classpath. It can be used to get the SOAP connector instance by its connector ID, which is soap-http-connector.

SoapHttpConnector soap = Connectors.getConnector(SoapHttpConnector.ID);

The SOAP connector extends the Camunda Connect HTTP connector which uses the Apache HTTP client in the default implementation. To read about default and custom client configuration, please see the corresponding section in the HTTP connector docs.

Request

Creating a Request

The SOAP HTTP connector can be used to create a new request, set a URL, content type and payload.

connector.createRequest()
  .url("http://camunda.org/soap")
  .soapAction("doIt")
  .contentType("application/soap+xml")
  .payload(soap_envelope)
  .execute();

Adding HTTP Headers to a Request

To add own headers to the HTTP request the method header is available.

connector.createRequest()
  .url("http://camunda.org/soap")
  .soapAction("doIt")
  .contentType("application/soap+xml")
  .header("Accept", "application/xml")
  .payload(soap_envelope)
  .execute();

Using the Generic API

Besides the configuration methods also a generic API exists to set parameters of a request. The following parameters are available:

Parameter Description
method Sets the HTTP method of the request
url Sets the URL of the request
headers Contains a map of the configured HTTP headers of the request
payload Sets the payload of the request

This can be used as follows:

HttpRequest request = http.createRequest();
request.setRequestParameter("method", "GET");
request.setRequestParameter("url", "http://camunda.org");
request.setRequestParameter("payload", "hello world!");

Response

A response contains the status code, response headers and body.

Integer statusCode = response.getStatusCode();
String contentTypeHeader = response.getHeader("Content-Type");
String body = response.getResponse();

After the response was processed it should be closed.

response.close()

Using the Generic API

Besides the response methods a generic API is provided to gather the response parameters. The following parameters are available:

Parameter Description
statusCode Contains the status code of the response
headers Contains a map with the HTTP headers of the response
response Contains the response body

This can be used as follows:

response.getResponseParameter("statusCode");
response.getResponseParameter("headers");
response.getResponseParameter("response");

On this Page: