1

I'm using JaxWs/JaxB in a webservice, but I don't like the fact that all my xml files (be it the ones I send or receive) contain SOAP envelopes. How can I get rid of those?

All I need is a clean xml file that the web service returns without any SOAP envelope. That part of the xml file is redundant in my case.

I have spent several days on this, but I just can't seem to get rid of it.

Bob Kaufman
  • 12,864
  • 16
  • 78
  • 107
Shadox
  • 19
  • 2
  • 1
    I don't know for sure, but I would have thought that an XML file can contain only a single root node. So if you drop the soap enveloppe, you 're left with the header and the body as both root nodes. Do you care only about the body, then? – Guillaume Polet Feb 14 '12 at 20:15
  • 1
    Why use SOAP if you don't want to use SOAP? Just pick a different method if you're not interested in using the facilities of the technology you have chosen. – KevinDTimm Feb 14 '12 at 20:36
  • @Guillaume: Well, basically I want a xml file that doesn't contain any soap elements or anything else that you usually wouldn't expect to see in a xml file... like: john doe nothing else, just the stuff that I can from my entities. – Shadox Feb 14 '12 at 21:25
  • @Kevin: I didn't really chose to use JaxWs. Its more of a task that I have to do and while it works.. I simply dislike how the xml files look. – Shadox Feb 14 '12 at 21:27
  • @user1209919 - It's a bunch more fun to use it the right way (and almost impossible to do it another way) - all the tools are built that way. In essence, you have no choice, it's SOAP, do it the SOAP way :) – KevinDTimm Feb 14 '12 at 21:52
  • Just ignore it and you get used to it! You're not the intended audience for the soap envelope, the computer is... ;) – davidfrancis Feb 14 '12 at 22:21

2 Answers2

3

jaxws is a technology for creating webservices using the SOAP protocol, which by definition includes the SOAP envelope. if you don't want the SOAP envelope, don't use jaxws/SOAP. you could instead use one of the jaxrs related technologies (e.g. jersey), or you could simply implement a servlet which accepts xml data.

jtahlborn
  • 52,909
  • 5
  • 76
  • 118
  • +1 for JAX-RS (JAXB is also the binding layer for JAX-RS), here is a link to a JAX-RS example: http://blog.bdoughan.com/2010/08/creating-restful-web-service-part-45.html – bdoughan Feb 14 '12 at 20:52
  • thanks, I already started looking at jaxrs, but I'm having certain difficulties with it, which is the reason why I wanted to know if I could just fix the stuff that I have rather than having to redo some work. – Shadox Feb 14 '12 at 21:31
0

You can use JIBX for this purpose: http://jibx.sourceforge.net/

nkare
  • 397
  • 6
  • 17