Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in building SOAP with XML

 
abhijeet shrivastava
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peer,

Now its working, Thanks for your guidance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic