I’m searching for a way, on the client side, to pass an object to my SOAPHandler without casting my Port object to a BindingProvider to get at the request context. Usually you see code like:
Map<String,Object> requestContext = ((BindingProvider)port).getRequestContext();
requestContext.put("key", object);
Where the code in your handler would look like:
public boolean handleMessage(SOAPMessageContext context) {
Boolean isRequest = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (isRequest) {
// Do stuff to SOAP header based on "object"
}
return true;
}
I don’t like the cast because I’m using Spring’s AOP to wrap the calls from the client-side Port object, and the cast causes it to error.
Are you using a version of spring prior to 2.5.6? If that is the case, you may just need to upgrade spring. This change log shows that they added support for the BindingProvider interface in version 2.5.6.