This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Java - creating Web Service Request using JDOM - Header issue  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I done many integrations using JDOM in Eclipse but for first time I have an issue because my SOAP XML message should contain and `HEADER` element wuth specific elements. This is my whole message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agi="http://agilent.parlayx.sms">
<soapenv:Header>
<cppass>test</cppass>
<cpuname>test</cpuname>
</soapenv:Header>
<soapenv:Body>
<agi:sendBulkSms>
<address>tel:3876123456</address>
</agi:sendBulkSms>
</soapenv:Body>
</soapenv:Envelope>


I created `BODY` structure using this:

Element top = new Element("sendBulkSms", agi);
Document jDoc = new Document(top);

Element address = new Element("address", agi);
address.setText("tel:3876123456");
top.addContent(address);

This works OK I did it many times before. But is it possible to create and header element of message uisng JDOM or not? Because as far as I know only BODY element can be defined.

Thank you, I will appreciate help (I must do it over JDOM so there are no other alternative)
 
Ranch Hand
Posts: 718
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But is it possible to create and header element of message uisng JDOM or not? Because as far as I know only BODY element can be defined.


Yes, you can. The creation of Header is just like the creation of Body, kind of "business as normal".

If your Document is created along this line:

you can add the Header before Body...

After that, you build the Header just like how you build the Body (putting your jDoc into it, I suppose).

ps: How come your address is in no namespace (or is it somehow in some default namespace of agi)? In any case, you know better what you actially get and I am not in a position to take what you posted to the letter literally.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!