M Litherland a écrit :

Hi all,

I'm new to Axis and I am trying to create a SOAP client to communicate with a vendor. They have supplied me with the WSDL and I ran WSDL2Java against it to create my stubs. There are custom headers, so I specified the '-a' option for WSDL2Java to produce a stub for the custom header as well.

My problem is that I don't know what to do with this custom header. I can create the object and populate it as need be, but how do I tell my code to use that header? The code is very simple - essentially these three lines:

MySoapLocator msl = new MySoapLocator();
MySoap ms = msl.getMySoap(new java.net.URL(URL));
ms.send(message);

I would expect to be able to do something like this:

ms.setHeader(myHeaderObject);

You can do that :

MyService service = new MyServiceLocator();
MyPortType client = service.getService();
/* header */
Stub s = (Stub) client;
s.setHeader("namespace", "element name", new MyHeader(args));


and then continue on calling the methods as usually.
"namespace" is the namespace of the header;
"element name" is the element name of the header (I'm pretty logical here :)
MyHeader is the stub class created by Axis.

However, I couldn't find a way to make Axis use automatically the namespace and element name specified in the WSDL.

--
Julien

Reply via email to