Hi list,
I am generating axis2 client from Server WSDL. But server side they
require security and some soap header. The way I have implemented the
client is
wsdl2java -uri c:\test\MyService.wsdl -p com.test -d xmlbeans
After this I wrote my own test client class.
package com.test;
import com.xxx.services.my.v1.messages.HelloWorldRequestDocument;
import
com.xxx.services.my.v1.messages.HelloWorldRequestDocument.HelloWorldRequ
est;
public class TestClient {
public static void main(String args[]) {
try {
MyServicePortStub stub = new
MyServicePortStub();
HelloWorldRequestDocument req =
HelloWorldRequestDocument.Factory.newInstance();
HelloWorldRequest r =
req.addNewHelloWorldRequest();
r.setOptionalMessage("testmessage");
stub.helloWorld(req);
}catch(Exception e) {
e.printStackTrace();
}
}
}
Using this client I have monitored the soap request using tcpmonitor and
the soap request is like
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<helloWorldRequest
xmlns="http://services.bennycentral.com/my/v1/messages">
<OptionalMessage>testmessage</OptionalMessage>
</helloWorldRequest>
</soapenv:Body>
</soapenv:Envelope>
But I want to include following header elements in <soapenv:Header />
<wsa:Action soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="1"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing">http://serv
ices.xxx.com/xxx/v1:helloWorldIn</wsa:Action>
<wsa:To>urn:EvolutionBenefits:Services:V1:xxxService</wsa:To>
<wsse:Security soap:mustUnderstand = "1" xmlns:wsse =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-sece
xt-1.0.xsd">
<wsse:UsernameToken xmlns:wsu =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-util
ity-1.0.xsd" wsu:Id =
"SecurityToken-46eb6dc1-4792-4031-bc01-4692be8f1c2b">
<wsse:Username>xxx</wsse:Username>
<wsse:Password Type =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-
profile-1.0#PasswordText">xxx</wsse:Password>
<wsse:Nonce>Ood0sa4w4gMvvA4MIK3Q7g==</wsse:Nonce>
<wsu:Created>2005-12-08T23:46:20Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
So any one of you has any idea of how to include above header elements
then please let me know.
Thanks,
Amit Soni