This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

Objective: Connecting to endpoints with WS-Security for outgoing messages

<definitions xmlns="">
    <localEntry key="sec_policy" src="file:repository/samples/resources/policy/policy_3.xml"/>
            <endpoint name="secure">
                <address uri="http://localhost:9000/services/SecureStockQuoteService">
                    <enableSec policy="sec_policy"/>
        <header name="wsse:Security" action="remove"


Use the stock quote client to send a request without WS-Security. ESB is configured to enable WS-Security as per the policy specified by 'policy_3.xml' for the outgoing messages to the SecureStockQuoteService endpoint hosted on the Axis2 instance. The debug log messages on ESB shows the encrypted message flowing to the service and the encrypted response being received by ESB. The wsse:Security header is then removed from the decrypted message and the response is delivered back to the client, as expected. You may execute the client as follows:

ant stockquote -Dtrpurl=http://localhost:8280/

The message sent by ESB to the secure service can be seen as follows, when TCPMon is used.

POST http://localhost:9001/services/SecureStockQuoteService HTTP/1.1
SOAPAction: urn:getQuote
Content-Type: text/xml; charset=UTF-8
Transfer-Encoding: chunked
Connection: Keep-Alive
User-Agent: Synapse-HttpComponents-NIO

<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:xenc="" xmlns:wsa="" ..>
         <wsse:Security ..>
            <wsu:Timestamp ..>
            <wsse:BinarySecurityToken ...>
               <ds:KeyInfo Id="KeyId-29551621">
      <soapenv:Body xmlns:wsu="" wsu:Id="Id-3789605">
         <xenc:EncryptedData Id="EncDataId-3789605" Type="">
            <xenc:EncryptionMethod Algorithm="" />

  • No labels