cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xbranko <xbra...@netscape.net>
Subject Re: Sending XML payload without encoding it
Date Tue, 10 Mar 2009 16:34:30 GMT


Andrew Clegg-2 wrote:
> 
> I just found this message from last month...
> 
> How did you get the SOAPAction header thing to work in the end? I have
> 
> 

I couldn't get the action to appear either, so finally this is what I ended
up with:

    try
    {
      String xmlPayload = "<yourXML>...</yourXML>";
  
      Service service = Service.create(new URL(wsdl), SERVICE_NAME);
      InputStream is =  new ByteArrayInputStream(xmlPayload.getBytes());
      SOAPMessage message = MessageFactory.newInstance().createMessage(null,
is);
      DOMSource request = new
DOMSource(message.getSOAPBody().extractContentAsDocument());
    
      Dispatch<DOMSource> disp = service.createDispatch(PORT_NAME,
DOMSource.class, Service.Mode.PAYLOAD);
      DOMSource result = disp.invoke(request);
      DOMResult domResponse = new DOMResult();
      Transformer trans = TransformerFactory.newInstance().newTransformer();
      trans.transform(result, domResponse);
    }
    catch(Exception e)
    {
    	e.printStackTrace();
    }

Ideally, the CXF team would implement an annotation for parameter (say
@NoEncoding) that would just pass the content as is, i.e. without any XML
character encoding. Hey CXF team -- how about that?
-- 
View this message in context: http://www.nabble.com/Sending-XML-payload-without-encoding-it-tp21925398p22438203.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message