...
- add new namespaces to the SOAP request;
- add/modify existing SOAP headers;
- get the existing SOAP body;
- replace the entire body contents.
Info |
---|
UI Text Box |
---|
|
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 |
---|
|
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 |
---|
|
import com.aquima.interactions.communication.ISoapMessageContext;
import com.aquima.interactions.communication.ISoapMessageHandler;
public class WSSTimestampSoapHandler implements ISoapMessageHandler {
@Override
public void handle(ISoapMessageContext context) {}
} |
UI Text Box |
---|
type | note Info |
---|
Three demo demo ISoapMessageHandler implementations 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 |
---|
|
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) {}
} |
Info |
---|
Using the AquimaSoapMessageHandler annotation |
UI Text Box |
---|
|
Using the AquimaSoapMessageHandler 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 |
---|
|
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 |
UI Text Box |
---|
type | note Info |
---|
The ordering matters. The handlers are called in the order specified in the configuration. |
Note |
---|
|
Before Blueriq 12.8, the property was called soap_service_calls.<service_call>.handlers . |
...
Code Block |
---|
|
<?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 |
---|
|
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 |
---|
|
For more flexibility, the service call names and SOAP message handler names can be configured in a Web.config configuration section for your plugin. |
UI Expand |
---|
|
Content by Label |
---|
|
showLabels | false |
---|
max | 5 |
---|
spaces | BKB |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label in ("ws-security","soap","ws-addressing") and type = "page" and space = "BKB" |
---|
labels | SOAP WS-Security WS-Addressing