wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem in building SOAP with XML" Watch "Problem in building SOAP with XML" New topic
Author

Problem in building SOAP with XML

abhijeet shrivastava
Greenhorn

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();
sBody.addDocument(doc);

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
Bartender

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

xmlns=""

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
Greenhorn

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

Now its working, Thanks for your guidance.
 
jQuery in Action, 2nd edition
 
subject: Problem in building SOAP with XML
 
Similar Threads
need to add namespace ns2: in the all webservices response tags.
Binding XML to Java from SOAP message
Axis SOAPElement.addChildElement inserts it's own prefix
Few questions
storing xml fields into variables