0

I need to call asynchronous web service from my apache camel.

for that i need to pass replyTo Address in header from my camel-cxf.xml, when i call end system.

If i pass this as a header from SOAP UI, it work fine for me and end system send me reply to "xxxx" address.

<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> <wsa:ReplyTo> <wsa:Address>xxxx</wsa:Address> </wsa:ReplyTo> <wsa:MessageID>urn:uuid:111342</wsa:MessageID> </soapenv:Header>

But i need to set this property from my code.

In my process method , i done this

    QName qname1=QName.valueOf("{http://www.w3.org/2005/08/addressing}ReplyTo");
    SoapHeader header1 = new SoapHeader(qname1, "xxxx");

    String requestHeader = "<wsa:ReplyTo xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"> "
            + "<wsa:Address xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">xxxx</wsa:Address>"
            + "</wsa:ReplyTo>"
            + "<wsa:MessageID xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">urn:uuid:111342</wsa:MessageID>";


    final List<SoapHeader> headers=new ArrayList<SoapHeader>();
      headers.add(new SoapHeader(qname1,DOMUtils.readXml(new StringReader(requestHeader)).getDocumentElement()));

    exchange.getIn().setHeader(SoapHeader.HEADER_LIST,headers);

But it's not working.. can any one give me a proper solution?

kamesh
  • 41
  • 7
  • I found one solution is it true or not please tell me.... QName qname1=QName.valueOf("{http://www.w3.org/2005/08/addressing}ReplyTo"); String requestHeader = " " + "xxx" + ""; headers.add(new SoapHeader(qname1,DOMUtils.readXml(new StringReader(requestHeader)).getDocumentElement())); exchange.getIn().setHeader(SoapHeader.HEADER_LIST,headers); – kamesh Mar 12 '15 at 06:35

1 Answers1

1

If you use cxf you can use the JaxWsProxyFactoryBean for your client call and add the ws addressing feature to enable ws addressing.

For example

JaxWsProxyFactoryBean factory = ...;
factory.getFeatures().add(new WSAddressingFeature());

Kind regards, soilworker

soilworker
  • 1,317
  • 1
  • 15
  • 32