Results 1 to 4 of 4
- 08-05-2010, 11:48 PM #1
Member
- Join Date
- Aug 2010
- Posts
- 2
- Rep Power
- 0
Adding WS Addressing to SOAP header - ACK!
Hi, Everyone.
I am using Axis2 to generate client code and a unit test from a partners WSDL. In the resulting test, the SOAP xml is being generated just fine, except that there is no header being generated.
They're using WS-Addressing, and require their header to look something like:
I can not, for the love of mike, figure out how to get this wsa info into the header.Java Code:<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:Action>http://endpoint1URL </wsa:Action> <wsa:To>http://endpoint2URL </wsa:To> </soapenv:Header>
It seems like I should do something like this:
The options get set...but the headers are always missing. It's only if I adding custom headers that I can get _any_ headers to show up.Java Code:Options options = new Options(); options.setAction("enpoint1URL"); options.setTo(new EndpointReference("endpoint2URL")); stub._getServiceClient().setOptions(options);
Can someone help? How do I get that info into the header of my SOAP envelope?
- 08-06-2010, 12:59 AM #2
I think this is the ws-addressing module, that comes with axis2 distribution, but might need to be engaged in the server and the client by specifying the <module ref="addressing"/> in the axis2.xml.
See: Axis2/Java - Axis2 Advanced User's Guide
stub._getServiceClient().engageModule(moduleName)WS-Addressing Support
WS-Addressing support for Axis2 is implemented by the addressing module. To enable addressing, you need to engage the addressing module in both server and client sides.
1. To enable addressing at the server side, you need to copy the addressing.mar file to the modules directory of the server's axis2 repository. To engage the module, add a <module ref="addressing"/> to axis2.xml. The Addressing module can be engaged only at global level.
2. To enable addressing at the client side, you should add it to the repository and provide the repository as an argument to the ServiceClient or generated stub or have it in your classpath.
3. To engage the addressing module, you should either add <module ref="addressing"/> to the axis2.xml file at the client side or call
- 08-06-2010, 06:06 AM #3
Member
- Join Date
- Aug 2010
- Posts
- 2
- Rep Power
- 0
Thanks for the reply. That's just what I've done. Makes me wonder if my axis2.xml file is in the right place. I used axis2 wsdl2java from the command line (separate install) to generate the stub. Jarred up the class files with the generated build.xml and then included the jar in my maven repo. Then I use the classes in Eclipse. With all of those shenanigans, I'm not sure where the axis2.xml file should go. I also read about addressing.mar file, which should be with the axis2.xml file. Anywhere in my classpath, I guess?
- 08-06-2010, 11:16 PM #4
I would really love it if there was a way to stuff the axis2.xml into the classpath, then I would just shove it into the top level package inside my client jar file. But so far I have found axis2 clients really like to have
- the axis2.xml as a FILE SYSTEM path
- also a path to the crazy location of all these modules (*.mar) files, like the ws-addressing module.
For example, I boot up my axis2 client like this :
When I build web applications that in turn need to contain axis2 clients (and maybe even also be its own axis2 services), I create an initializer servlet that determines the real path from the servlet context. Thats the hard part for me that I haven't figured out, how to nicely make a launcher for the web services client that will detect the configuration folder path in a command line or stand alone application, without making some shell script or batch file to set up the current working folder before hand that is.Java Code:String endpoint = "http://127.0.0.1:myapp/services/MyService"; String pathToRepository = "./config/axis2"; // this contains nested folder "modules", which then contains the addressing.mar file String pathToClientConfig = "./config/axis2.xml"; // define a configuration context that knows where to find the axis2.xml // and the folder that contains the modules/ folder, that contains the .mar files modules we want to engage. ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(pathToRepository,pathToClientConfig); . // create instance of your service client using this context MyServiceStub stub = new MyServiceStub(ctx,endPoint); // now use your service client
Similar Threads
-
problem when generating MIME header of a SOAP packet using SAAJ
By kumar.jyotish@gmail.com in forum Advanced JavaReplies: 1Last Post: 10-18-2010, 05:03 PM -
Fixed Header
By Quirl in forum New To JavaReplies: 2Last Post: 07-28-2010, 10:19 PM -
ip addressing
By kevinnrobert in forum NetworkingReplies: 2Last Post: 04-02-2010, 06:06 PM -
Header/Footer
By selva.bics in forum New To JavaReplies: 0Last Post: 11-26-2009, 02:26 PM -
Getting Header Info
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 01:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks