You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Magnus Bergman <ma...@voiceprovider.com> on 2006/06/22 15:15:50 UTC

send soap:headers with wsdl2java generated code

Hi,
I can see that this has been discussed earlier on this list but yet I 
have not found an answer.

Using Axis 1.4.

I'm trying to call a service which is expecting custom soap:headers. I'm 
generating code with wsdl2java from the attached wsdl. If I use the -a 
option with wsdl2java I get the header-type 
SoapAuthenticationHeader.java. I do not know what to do with this class. 
I was expecting that I could pass this object as a parameter to the 
service-method, someway like this:

//create the service
Permission2Soap permissionService =
  new Permission2Locator().getPermission2Soap();
//create the header object
SoapAuthenticationHeader authHeader =
   new SoapAuthenticationHeader();
//set attributes on the header object
authHeader.setUser("aUser");
authHeader.setPassword("xyz");
//call the method, pass on the header object
LoginUserData loginData =
  permissionService.loginUser("john","123", authHeader);

but no such method is generated.

So, how do I use the header-class so Axis will send it as a soap:header 
to the server???

Any help appreciated!
Regards,
Magnus