Tried with both CXF 2.0.9 and 2.1.3:
I need to send payload that is XML. When I do, the content is encoded (i.e.
all '<' are replaced with <, '>' with > etc.), and the server throws
an exception because it doesn't expect payload to be encoded. I verified
that using soapui which sends the pure XML and receives correct answer from
the server.
Searching through the forum, I've implemented the alternative approach:
Service service = Service.create(new URL(wsdl), SERVICE_NAME);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
InputStream is = new StringBufferInputStream(xmlPayload);
Document newDoc = builder.parse(is);
DOMSource request = new DOMSource(newDoc);
Dispatch<Source> disp = service.createDispatch(PORT_NAME,
Source.class, Service.Mode.PAYLOAD);
disp.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
disp.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
"ServiceX");
Source result = disp.invoke(request);
With this approach, the server is returning:
"Unable to handle request without a valid action parameter. Please supply a
valid soap action."
I followed the code in the debugger, and saw that action parameter is being
set in the code, however, it does not get written out as part of the POST
request -- verified via the Network Protocol Analyzer -- the action is not
there.
Is there a third way? Ideally, I'd like to use the standard way, and just
indicate to CXF to do nothing with the payload, to just pass it through as
is.
Any help greatly appreciated!
--
View this message in context:
http://www.nabble.com/Sending-XML-payload-without-encoding-it-tp21925398p21925398.html
Sent from the cxf-user mailing list archive at Nabble.com.