Hi all, I am using SAAJ to access web service. I am having a arbitary xml in my soap request. I am forming that xml seperately. but the problem is I am unable to add that xml document to the header element(In Soap body I can add another xml through body.addDocument() but Soap Header doesn't have one).I tried using header.addTextNode() but the markups are not coming properly. Please help me.
Seems to me that adding arbitrary XML to SOAP Headersis contrary to the whole SOAP design, where headers are supposed to be processing information and the body is the arbitrary XML message to be delivered.
Hi guys, I think should have describe my problem more clearly. I am using xml beans to construct the soap message. my soap message has a message header in the header field. The message header itself is a xml defined by the schema. I am converting these schemas in to java bean format using xml beans. The process I am following is: 1. form message header(xml). 2. form bodyXml (which is again defined by a seperate schema) 3. using saaj form soap request 4. get the soap header 5. add message header(xml) to the header 6. get soap body 7. add bodyXml to soap body 8. send soap message
In the above steps I can't able to perform the 5th step.Please suggest me if there is any way to achive this.
Like Bill said, it's not a good idea to stuff XML into a SOAP header. But if for some reason (which one?) you have to do it, it should be possible. What does the XML look like that you are trying to put there, and what exactly is happening if you do?
Ping & DNS - updated with new look and Ping home screen widget
I must write a web service client to access a web service which requires the requests in certain format(The request schema requires an xml in header).I give the sample request below: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header > <MessageHeader MessageID="0000" MessageName="ABCD" TimeStamp="mmddyyHHMMSS"/> </soap:Header> <soap:Body > <..body xml..> </soap:Body> </soap:Envelope>
As I already told, I used xml beans to create the message header. when I used header.appendChild(node);, I am getting the below error:
Then I tried converting xml asstring and add it to header using header.setTextNode(String). It ran withoutany exception but the markups are coming like < > etc. so due to this the web service gives fault response. I am new to soap and I am seriously doubting whether my approach is right and also is there any other way to acheive the above message format?.Thaks for all the help