SOAPElement addTextNode() with XML content
Hi everybody,
I have a big problem. I've got a requirement here that the XML request for <xmlRequest> element must be actual XML content. The SOAP envelope has this requirement:
Code:
<requestXML>string</requestXML>
When I construct SOAPElement as follows:
Code:
QName name = new QName("requestXML");
SOAPElement requestXML = bodyElement.addChildElement(name);
requestXML.addTextNode("<XML content>");
and call webservice, I get the following back:
Code:
<requestXML><XML content></requestXML>
Code="1001">XML request cannot be empty.</Error><
So it seems that when I pass XML Content into addTextNode() the '<' and '>' tags change into other characters and XML content is not recognized.
Does anybody know how to pass XML Content into addTextNode() as string and preserve XML Content?
Thank you,
Victor.
Re: SOAPElement addTextNode() with XML content
Find out from the web service exactly what it expects first off.
Then find out what that error means, because I wouldn't expect that sort of error if it was unable to parse the XML.
Re: SOAPElement addTextNode() with XML content
Thanks for replying but I found a different approach using NetBeans webservices feature. Hopefully this will help others. NetBeans automatically generated WS classes and I could successfully pass XML request as String parameter into webservice operation that NetBeans generated :(clap):
Re: SOAPElement addTextNode() with XML content
Oh right.
You mean you were trying to do this manually?
...oh yes, of course you were. Sorry, wasn't reading closely enough!
Yep, I would recommend a generator (and there's one with pretty much any framework, Axis, JAX-WS, etc).