This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Adding payload to SOAP body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Adding payload to SOAP body" Watch "Adding payload to SOAP body" New topic

Adding payload to SOAP body

Matthew MacMillan

Joined: May 23, 2011
Posts: 2

Am trying to add a hard coded payload to a SOAP message - but it's escaping the < and > characters in the payload to & lt ; and & gt ;

SOAP envelope before adding child payload

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv=""><soapenv:Body>soapenv:Body></soapenv:Envelope>

from this code: -

Add the payload to the SOAP envelope

gives this SOAP message

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv=""><soapenv:Body>& lt ;GetMyWebMethod xmlns='' /& gt ;</soapenv:Body></soapenv:Envelope>

The SOAP message I want is: -

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv=""><soapenv:Body><GetMyWebMethod xmlns='' />;</soapenv:Body></soapenv:Envelope>

Any idea how to solve?

Alex Hurtt
Ranch Hand

Joined: Oct 26, 2010
Posts: 98
Try using one of the fac.createOMElement(...) methods on your 'fac' object instead of createOMText(...). It looks like they've sort of reinvented DOM parsing with this Axiom API to some extent.

If you spend a few minutes and study the API documentation for your OMNode class here:

You will see there are constants defined in the interface that indicate what type of Node the implementing instance will be. These are commonly defined XML node types and each will be treated differently according to XML specs. If you are creating a text node and trying to add that to the body of your envelope, the Axiom framework will rightly treat it as plain text containing characters that must be escaped according to XML specification.
wood burning stoves
subject: Adding payload to SOAP body
Similar Threads
axis2: set SC_BAD_REQUEST with AxisFault
XML in Payload, fault returned.
SOAP Validation Help Requested
E_unsupported (10050) problem with uddi4j FindBusinessExample
org.apache.axis2.AxisFault: Unexpected EOF; was expecting a close tag