Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrate text boxes

...

Blueriq

...

Blueriq supports many features of the SOAP standard, but not all of them. If you want to modify a SOAP request before being sent, but after the payload has been generated, this article gives you pointers of how to do it.. Example use cases for this include adding support for WS-Security or WS-Addressing enabled web services or adding custom SOAP headers for custom web service processors. 


The operations currently available are:

  • add new namespaces to the SOAP request;
  • add/modify existing SOAP headers;
  • get the existing SOAP body;
  • replace the entire body contents.
note
UI Text Box
type
Info

Replacing the body contents is not intended to be used for post-processing individual parts of the body (like replacing attributes and formatting values, this is the responsibility of the mapping).

Info
UI Text Box
typenote

At the moment, hooks do not exist for processing the SOAP response. These hooks are used for processing the request only.

Step-by-step guide

Create a class that implements com.aquima.interactions.communication.ISoapMessageHandler

Code Block
languagejava
import com.aquima.interactions.communication.ISoapMessageContext;
import com.aquima.interactions.communication.ISoapMessageHandler;

public class WSSTimestampSoapHandler implements ISoapMessageHandler {
	@Override
	public void handle(ISoapMessageContext context) {}
}
Info

Three demo ISoapMessageHandler implementations

UI Text Box
typenote

Three demo ISoapMessageHandler implementations are attached to this page. The code is provided for demonstration purposes only and should not be used in a production environment.

Annotate the class with com.aquima.web.config.annotation.AquimaSoapMessageHandler

...

Code Block
languagejava
import com.aquima.interactions.communication.ISoapMessageContext;
import com.aquima.interactions.communication.ISoapMessageHandler;
import com.aquima.web.config.annotation.AquimaSoapMessageHandler;
 
@AquimaSoapMessageHandler(value = "WSSTimestamp")
public class WSSTimestampSoapHandler implements ISoapMessageHandler {
	@Override
	public void handle(ISoapMessageContext context) {}
}
UI Text Box
type
note
Info

Using the the AquimaSoapMessageHandler annotation  annotation will instantiate the handler using the default factory that searches the Spring context for these annotations. You can provide your own factory implementation if wanted by implementing implementing com.aquima.interactions.communication.ISoapMessageHandlerFactory and  and annotating the class with with com.aquima.web.config.annotation.AquimaSoapMessageHandlerFactory.

Info

The AquimaSoapMessageHandler annotation

UI Text Box
typenote

The AquimaSoapMessageHandler annotation makes the class a Spring bean. Make sure the Spring configuration scans the package the handler resides in for component annotations (using using context:component-scan for  for example).

Implement the handle(ISoapMessageContext) method

...

Code Block
blueriq.soap-service-calls.wss_greet.handlers=WSSTimestamp,WSSUsernameToken,WSAddressing
note
UI Text Box
type
Info

The ordering matters. The handlers are called in the order specified in the configuration.

Note
titleBefore Blueriq 12.8

Before Blueriq 12.8, the property was called soap_service_calls.<service_call>.handlers.

...

Code Block
languagexml
<?xml version="1.0"?>
<soapenv:Envelope xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	<soapenv:Header>
		<wsse:Security soapenv:mustUnderstand="1">
			<wsu:Timestamp wsu:Id="TS-930e7809-2cde-415b-ad5c-0af0b9127083">
				<wsu:Created>2015-04-02T09:46:58.824Z</wsu:Created>
				<wsu:Expires>2015-04-02T09:51:58.824Z</wsu:Expires>
			</wsu:Timestamp>
		</wsse:Security>
	</soapenv:Header>
	<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
	   ...
	</soapenv:Body>
</soapenv:Envelope>

.NET registration

In the .NET runtime, the usual registration mechanism is used to register a SOAP message handler:

Code Block
languagec#
namespace Example
{
	public class ExamplePlugin : IWebApplicationPlugin
	{
		// ...
 
		public void Register(IRegistrationContext context)
		{
			// register SOAP message handlers for the wss_greet service call, one by one
			context.Register("wss_greet", "WSSTimestamp", new WSSTimestampSoapHandler());
			context.Register("wss_greet", "WSSUsernameToken", new WSSUsernameTokenSoapHandler());
			context.Register("wss_greet", "WSAddressing", new WSAddressingSoapHandler());
		
			// or register a SOAP message handler factory
			context.Register(new ExampleSoapMessageHandlerFactory());
		}
	}
}

The ISoapMessageHandler and ISoapMessageHandlerFactory interfaces are implemented in .NET in the same way as in Java.

UI Text Box
typenote

 For more flexibility, the service call names and SOAP message handler names can be configured in a Web.config configuration section for your plugin.

SOAP WS-Security WS-Addressing
UI Expand
titleRelated articles
Content by Label
showLabelsfalse
max5
spacesBKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("ws-security","soap","ws-addressing") and type = "page" and space = "BKB"
labels