Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Adding SOAP elements through DOM

 
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)

 
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(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
Posts: 186
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 27211
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A solution? First explain why you think it is a problem. Bearing in mind, of course, that namespace declarations are inherited by child elements.
 
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic