Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Posting or streaming XML to WebService

 
Chris Gastin
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one point me to a simple tutorial which allows you to post or stream an xml to a URL. Does this make any sense? Is this even possible with web services?



 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you Google for "sending HTTP POST with Java", you'll find plenty of sample code like this. You just need to replace the 'data' variable in that example with the raw XML.
 
Sonal Jogi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to post a xml document to a web service using SOAP and not URLConnection class. Could someone please help me with this.

Thanks & Regards,
sonal
 
Ashutosh Shahi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this is what u need exactly, but u can do something like this using SAAJ and DOM apis:

 
Sonal Jogi
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ashutosh,

Thanks for the code. Which SOAP implementation did u use? I mean which vendor's api? And also do we need a proxy server on the application server box.

Regards,
sonal
 
Ashutosh Shahi
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I used Axis jars, but saaj and dom apis are standard and will work irrespective of which implementation u choose. I don't think there is any need of proxy server on the application server.
Ashutosh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic