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 Am I just stupid, or is this really supposed to be difficult? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Am I just stupid, or is this really supposed to be difficult?" Watch "Am I just stupid, or is this really supposed to be difficult?" New topic
Author

Am I just stupid, or is this really supposed to be difficult?

Rick Reumann
Ranch Hand

Joined: Apr 03, 2001
Posts: 281
I got tasked with a seemingly simple task. The client needs to be able to submit a simple XML doc (from a .NET or Java client) to a web service. I figure, ok, this should be easy since just playing around my little Hello World app done with axis2 worked out fine (a bit awkward on the client stub side but I figured it out). Now, however, I'm running into issues trying to get an XML string to post to the web service. (posted here here earlier about it.)

Been googling and trying different things. Apparently, if what I've researched is correct, I'll need to accept something like a byte[] on the web service side or else post to the service as an attachment with MTOM or SwA. Looking at the MTOM and SwA examples, this approach seemed like a ton of work. (It didn't look like the easy approach of simply adding a services.xml file describing my POJO would work that nicely. The client side looked pretty bad too.) So I figured it should be easy enough to just use a byte array on the service side method (instead of a String), but then my axis2 generated client stubs seems to want to use DataHandler (not take a byte[] directly) but I can't figure out what in the world I'm supposed to do with it to get my byte[] array into it.

I can't be the first person trying to send XML to a web service, so I just be missing something simple. (I still don't get what's going on that just doing escaping of the characters doesn't help xmlSpec = xmlSpec.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">");
It's as if, even escaped, the soap body must get messed up.)

Any pointers on what I need to do get a simple XML doc sent to a webservice? I feel like an idiot that it's taken me this long and don't have a solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Am I just stupid, or is this really supposed to be difficult?
 
Similar Threads
Can any one tell me the list of Document engines
SOAP with Attachments (SwA) with Axis2, problem.
MTOM content transfer - Axis2
Apache CXF with MTOM enabled WCF Service
sending pdf or any attachment from a java webservice to java client using JAX-WS and SAAJ