Results 1 to 4 of 4
  1. #1
    victor_sk is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default 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:

    Java Code:
     <requestXML>string</requestXML>
    When I construct SOAPElement as follows:

    Java Code:
    QName name = new QName("requestXML");
            SOAPElement requestXML = bodyElement.addChildElement(name);
            requestXML.addTextNode("<XML content>");
    and call webservice, I get the following back:

    Java Code:
    <requestXML>&lt;XML content&gt;</requestXML>
    Code="1001"&gt;XML request cannot be empty.&lt;/Error&gt;&lt;
    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.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default 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.

  3. #3
    victor_sk is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default 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

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default 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).

Similar Threads

  1. Replies: 1
    Last Post: 04-19-2011, 09:52 AM
  2. Content Filtering
    By redforce.bala in forum Java Servlet
    Replies: 3
    Last Post: 10-28-2010, 05:01 PM
  3. Replies: 2
    Last Post: 05-30-2009, 11:42 AM
  4. Can not see the content of the url
    By neeraj.singh in forum Java 2D
    Replies: 0
    Last Post: 02-17-2009, 02:44 PM
  5. Two content panes in one GUI?
    By Leprechaun in forum New To Java
    Replies: 1
    Last Post: 01-31-2008, 05:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •