« Return to Thread: SOAP headers

RE: SOAP headers

by antoine.borg :: Rate this Message:

Reply to Author | View in Thread

Hi,

The concept of an interceptor is right but perhaps you could have obtained
the same result by using the MessageProperties Transformer
http://mule.mulesource.org/display/MULE2USER/Using+Transformers

HTH


Antoine Borg, Senior Consultant | Tel: +356 21334457 | Fax: +356 21 334156
ricston Ltd., Lincoln, 7 Ferdinand Grech Street, Lija LJA1142, MALTA
email: antoine.borg@... | blog: blog.ricston.com | web: ricston.com

-----Original Message-----
From: bug_bug_bug [mailto:S313563@...]
Sent: Tuesday, June 17, 2008 8:33 AM
To: user@...
Subject: Re: [mule-user] SOAP headers



ok, i found one solution to this after so much trial and error. again not
sure whether its the right method. but its working for me. if anybody can
suggest a better method, pls let me know.

First is add an interceptor in mule for cxf endpoint:

                        <cxf:outInterceptors>    
                             <spring:bean
class="mulelocal.EchoInterceptor"/>
                       </cxf:outInterceptors>



inside the interceptor- handleMessage

         List l = message.getHeaders();
         Document d = DOMUtils.createDocument();
          Element  securityParent=
d.createElementNS("http://schemas.xmlsoap.org/ws/2002/secext","wsse:Security
");  
          Element userNameToken = d.createElement("wsse:UserNameToken");
          securityParent.appendChild(userNameToken);
          Element userName = d.createElement("wsse:UserName");
          userName.setTextContent("S313563");
          userNameToken.appendChild(userName);
          Element password = d.createElement("wsse:Password");
          password.setTextContent("S313563-pass");
          userNameToken.appendChild(password);
          SoapHeader header = new SoapHeader (new
QName("http://schemas.xmlsoap.org/ws/2002/secext", "Security"
,"wsse"),securityParent);
          l.add(header);


and the ouput trace gave soap request like this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <mule:header xmlns:mule="http://www.muleumo.org/providers/soap/1.0">
     
<mule:MULE_CORRELATION_ID>36bde261-3c35-11dd-baca-3180a1f23821</mule:MULE_CO
RRELATION_ID>
     
<mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE>
      <mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE>
    </mule:header>
    <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/secext">
       <wsse:UserNameToken>
          <wsse:UserName>S313563</wsse:UserName>
          <wsse:Password>S313563-pass</wsse:Password>
       </wsse:UserNameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
      <ns2:echo xmlns:ns2="http://local/"><arg0>1</arg0></ns2:echo>
  </soap:Body>
</soap:Envelope>
--
View this message in context:
http://www.nabble.com/SOAP-headers-tp17848187p17878980.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: SOAP headers