Calling a SOAP Web Service using the HTTP Client Connector

Document created by andrew_zeon065198 Employee on Aug 12, 2018
Version 1Show Document
  • View in full screen mode

There are times when using the Web Service Client Connector may not provide the necessary results you are looking for. For example, if there are custom SOAP faults which need more complex manipulation the HTTP Client Connector may give you more flexibility. This article describes how to call a SOAP Web Service using the HTTP Client Connector.

 

Creating the Request/Response Profile

You will first need to create the request and response profile which includes the SOAP envelope and headers. You can use a third-party tool such as SOAP UI to generate a sample SOAP payload. Note that in my example it uses a WS-Security username token for authentication:

 

Another way is to use the Web Service SOAP Client connector to call the service with connector tracing turned on (Turning on tracelogging for various connectors). You can then inspect the atom logs to find samples of the request and response XML.

 

Configuring the HTTP Client Connector

Drag and drop a HTTP Client connector shape and configure it as follows:

 

  1. Set the Action to "Send"
  2. Create a HTTP connection to the Web Service server
  3. Create a HTTP operation

    Note: you need a "SOAPAction" header, even it it's an empty value. You need to wrap the value in double quotation marks ("), e.g. "http://schemas.microsoft.com/sqlserver/2004/SOAPsqlbatch" or "" (empty value). The SOAPAction header is specified by the web service

    .

 

Generating the Nonce

For this particular Web Service it requires a nonce. A nonce is a random value that the sender creates to include in each UsernameToken. Here is the Groovy script that was used to generate the nonce:

 

import java.util.Properties;
import java.io.InputStream;
import com.boomi.execution.ExecutionManager;
import com.boomi.execution.ExecutionUtil;


for( int i = 0; i < dataContext.getDataCount(); i++ ) {
InputStream is = dataContext.getStream(i);
Properties props = dataContext.getProperties(i);

String dateTimeString = Long.toString(new Date().getTime());
byte[] nonceByte = dateTimeString.getBytes();
String nonce = nonceByte.encodeBase64().toString();

ExecutionUtil.setDynamicProcessProperty("nonce", nonce, false);

dataContext.storeStream(is, props);
}

 

Map the "nonce" dynamic process property to the nonce element in the UsernameToken.

 

Putting it all together

Once the building blocks are in place calling the Web Service is like calling any other HTTP service:

 

 

Generate the nonce and map the input SOAP request before calling the HTTP Client connector. In this example a Route shape is used to route the process depending on whether a SOAP faultcode is generated or not.

1 person found this helpful

Attachments

    Outcomes