aspose file tools*
The moose likes XML and Related Technologies and the fly likes Adding SOAP elements through DOM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Adding SOAP elements through DOM" Watch "Adding SOAP elements through DOM" New topic
Author

Adding SOAP elements through DOM

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear Friends,

I need to create a XML string from DOM which will be sent across to a web service. I developed the following code which will create a XML string:


This is the output:


Following are the queries:
(1) The attribute namespaces for SOAP Envelope is added correctly but not in SOAP Header and SOAP Body
(2) How to complete the SOAP header tag in the beginning itself. I must complete the header tag like this <SOAP-ENV:Header />
(3) How to remove the standalone attribue in the xml header
(4) How can i found out the DOM levl used?
(5) Is this the correct way for appending SOAP headers? If not please direct me a correct way.

Request you to clear my queries.

Thank you very much,
Regards,
Vijay

(Edited to make code narrower: PC)

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18660
    
    8

(1) I don't think there's anything wrong with your namespace declarations. What is the problem in your opinion?

(2) If you want an element to be an empty element then don't write code which adds children to it.

(3) Go back to the API documentation for OutputKeys and look again.

(4) I don't know. Why does it matter?

(5) If it produces the correct output then it is a correct way.
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
Dear Paul,

Thank you very much for the reply. The problem is just as i am getting the attribute namespaces in the soap envelope

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2000/XMLSchema" xmlns:xsi="http://www.w3.org/2000/XMLSchema-instance">

i'm not getting it in the SOAP header and in SOAP body. The output is only the elements:

<SOAP-ENV:Header>
<SOAP-ENV:Body>

Kindly provide a solution for this.

Thanks,
Vijay

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18660
    
    8

A solution? First explain why you think it is a problem. Bearing in mind, of course, that namespace declarations are inherited by child elements.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Adding SOAP elements through DOM