Reputation: 2780
I am using Spring-WS with JAXB.
Have the next code:
WebServiceTemplate template = (WebServiceTemplate) ctx.getBean("requestWsTemplate");
ObjectFactory f = new ObjectFactory();
Request r = f.createRequest();
r.setContent("<age>25</age>");
template.marshalSendAndReceive(r);
the <age>
tag gets escaped to <age>
Is there a way to send it raw/unescaped?
Thanks.
Upvotes: 3
Views: 3227
Reputation: 2780
I ended up using JAXB.
After marshalling I replace the content in my marshalled content and then send over the network the modified content.
Upvotes: 1
Reputation: 2065
I think Jaxb is not the way to go since it needs to have a correct java structure for the xml (mostly based on an XSD file). If you want to marshall something like this you'd better use XStream (or any other non-schema based marshaller of course) as a marshaller since that's not based on a schema.
At least, that's how I solved this a while ago :)
On the other hand, if you've got any influence on the receiving end, you can simply decode the given (encoded) xml by using XStream. Which makes it a bit easier on the client side.
Upvotes: 0