wood burning stoves*
The moose likes Web Services and the fly likes Problem in building SOAP with XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem in building SOAP with XML" Watch "Problem in building SOAP with XML" New topic

Problem in building SOAP with XML

abhijeet shrivastava

Joined: Jan 05, 2007
Posts: 10
HI All,

I have a xml document, i want to attach it inside SOAP body i.e. i want to make it as SOAP body, for that i am using this code (Consider the parsing is done by dom parser and i have a Document object as doc.)

SOAPEnvelope envelope = new SOAPEnvelope();
SOAPBody sBody = (SOAPBody)envelope.getBody();

But i am getting this Exception - local part cannot be "null" when creating a QName at javax.xml.namespace.QName.<init>(Unknown Source)

Can some body guide me on this or can suggest some alternative approach.
Peer Reynders

Joined: Aug 19, 2005
Posts: 2921
I think that your XML document doesn't specify a namespace. At the very least put a


attribute on the root element of your document - though a namespace that uniquely identifies the XML application that you are using would be preferable.

Ronald Bourret's XML Namespaces FAQ
James Clark: XML Namespaces

Importing a DOM element into a SAAJ 1.2
(J2EE Web Services (RMH; Richard Monson-Haefel) (amazon US))
abhijeet shrivastava

Joined: Jan 05, 2007
Posts: 10
Hi Peer,

Now its working, Thanks for your guidance.
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem in building SOAP with XML
Similar Threads
Binding XML to Java from SOAP message
need to add namespace ns2: in the all webservices response tags.
Few questions
storing xml fields into variables
Axis SOAPElement.addChildElement inserts it's own prefix