Hello All,
I have a problem concerning usage of Axis 1.4 with WSS4J. I have to send a
request based on a document/wrapper style WSDL. Everything works fine when I
don't use Web Service Security. Then a request is sent containing proper
message parts and in proper namespaces.
I configure WSS4J using client-config.wsdd with service part like below:
<service name="BillingConnectorServicePort">
<requestFlow>
<handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
<parameter name="action" value="UsernameToken"/>
<parameter name="passwordType" value="PasswordText" />
</handler>
</requestFlow>
</service>
The username and password is set at runtime in the stub:
stub._setProperty(WSHandlerConstants.*USER*, authUser);
stub._setProperty(WSHandlerConstants.*PW_CALLBACK_REF*, *this*);
Then I get the following XML when sending a request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security xmlns:wsse="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
soapenv:mustUnderstand="1"><wsse:UsernameToken xmlns:wsu="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="UsernameToken-15275681"><wsse:Username>username</wsse:Username><wsse:Password
Type="
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><methodNamexmlns="
http://no.namespace.tld"><request><RequestIDxmlns="">40001234</RequestID><Msisdn
xmlns="">123421342314</Msisdn></request></methodName></soapenv:Body></soapenv:Envelope>
What is wrong here is the namespace of *Msisdn* and *Request* parameters. It
is empty while it should not be. When I don't use WSS4J I get correct
request:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><methodName xmlns="
http://no.namespace.tld"><request><ns1:RequestID xmlns:ns1="java:
package.namespace.1">6179888880</ns1:RequestID><ns2:Msisdn xmlns:ns2="java:
package.namespace.2
">0000001</ns2:Msisdn></request></getSubscriberProfile></soapenv:Body></soapenv:Envelope>
Could you please tell me why is it so? I thought that appending a SOAP
header does not affect the way the body is encoded. Or maybe I am missing
some standard or convention using which WSS4J should be used? I know that
for rpc/literal style the namespaces must be null but here we have a
document/wrapper style.
Thanks for any help and Best Regards,
Grzegorz