Meaningless Drivel is fun!*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 2906
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))


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
abhijeet shrivastava
Greenhorn

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
Axis SOAPElement.addChildElement inserts it's own prefix
storing xml fields into variables
Few questions
Binding XML to Java from SOAP message
need to add namespace ns2: in the all webservices response tags.