I am using SAAJ to send a SOAP message that needs to be exactly in a certain format. I have managed to get quite close yet there are a few things that I am unable to get working with SAAJ. Would be great if somebody on the list can help out. I have simplified my real life example so that others could try out the code and hopefully come up with a solution.
So the things that change between expected and actual are: 1) SOAP-ENV: The tag name is SOAP-ENV instead of SOAP 2) SAAJ forces me to have a prefix and namespace to all header tags. So I could not create the expected tag within the SOAP header. Wish to get rid of DontWantThisPrefix and DontWantThis in the message. The Java Code that generates the above output is as follows:
Hi, harshad: I tried your sample code on my machine and here is the result: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><DontWantThisPrefix:Head1 xmlns ontWantThisPrefix="DontWantThis">H1</DontWantThisPrefix:Head1></SOAP-ENV:Header><SOAP-ENV:Body><Body1>B1</Body1></SOAP-ENV:Body></SOAP-ENV:Envelope> I guess probably you have some out-of-date JAR files in your classpath which caused the problem. Good luck --Jian