File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Posting or streaming XML to WebService Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Posting or streaming XML to WebService" Watch "Posting or streaming XML to WebService" New topic
Author

Posting or streaming XML to WebService

Chris Gastin
Ranch Hand

Joined: Aug 13, 2002
Posts: 51
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?





Chris Gastin<br />SCJP 1.4<br />SCWCD 1.3
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sonal Jogi
Greenhorn

Joined: Oct 19, 2004
Posts: 23
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

Joined: Feb 06, 2005
Posts: 36
Not sure if this is what u need exactly, but u can do something like this using SAAJ and DOM apis:



<a href="http://blogs.sun.com/roller/page/ashutosh" target="_blank" rel="nofollow">http://blogs.sun.com/roller/page/ashutosh</a>
Sonal Jogi
Greenhorn

Joined: Oct 19, 2004
Posts: 23
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

Joined: Feb 06, 2005
Posts: 36
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Posting or streaming XML to WebService