I've created client stubs for a SOAP service using the Axis WSDL2Java program. With the '-a' switch it produces a stub for the headers that the service requires. The problem that I have is that there doesn't appear to be a way to tell your client program to use the header object you create. I've found some hints online that tell you how to create a header without using the stub code, but it seems there really ought to be a way.
Just wanted to say thanks to both of you guys - I had the same problem, and hadn't even found the -a switch, so that was helpful in itself!
I actually needed to use a slightly different solution from the one Ray suggested, and I also needed a slight intellectual leap, which wasn't immediately obvious from his answer, so I'll show my solution here, just in case:
As with Ray, my class generated for the header info will be MyHeaderType, and the instance of my generated Stub class is binding.
I actually had to cast binding, and the relevant line reads:
Where http://.../... represents the namespace of the WSDL, tns:MyHeaderType is the name of the type required in my header (taken from the WSDL), and header is an instance of MyHeaderType.
Not sure about the difference between my setHeader(), and Ray's addHeader() methods, but I couldn't find an addHeader() method, and setHeader() works just fine!