title: WSO2 ESB - How to get and set cookies in WSDL calls in
body: <p>I use WSO2 ESB and want to connect 2 web services together - on a timer pull data from one service and push it to another. </p>
  
  <p>The problem is that one of the services authenticates callers with cookies. You first need to call a GetSession method with the username and password. The response to this call sets a cookie. Then with this cookie you make other calls.</p>
  
  <p>I couldn't find anywhere in the documentation, how can I get a cookie from the result of one call and set it for a subsequent call. Is it at all achievable? If so - how?</p>
  
  <p>Here is my sequence code:</p>
  
  <pre><code>&lt;sequence xmlns="http://ws.apache.org/ns/synapse" name="SampleName" trace="enable"&gt;
     &lt;payloadFactory media-type="xml"&gt;
        &lt;format&gt;
           &lt;Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"&gt;
              &lt;Body&gt;
                 &lt;GetSessionWithCredentials xmlns="blabla"&gt;
                    &lt;User&gt;bla&lt;/User&gt;
                    &lt;Password&gt;bla&lt;/Password&gt;
                 &lt;/GetSessionWithCredentials&gt;
              &lt;/Body&gt;
           &lt;/Envelope&gt;
        &lt;/format&gt;
     &lt;/payloadFactory&gt;
     &lt;call&gt;
        &lt;endpoint key="conf:/Tracker"&gt;&lt;/endpoint&gt;
     &lt;/call&gt;
     &lt;payloadFactory media-type="xml"&gt;
        &lt;format&gt;
           &lt;GetTrackingList xmlns="blabla"&gt;&lt;/GetTrackingList&gt;
        &lt;/format&gt;
     &lt;/payloadFactory&gt;
     &lt;property xmlns:ns="http://org.apache.synapse/xsd" name="Cookie" expression="$trp:Cookie"&gt;&lt;/property&gt;
     &lt;call&gt;
        &lt;endpoint key="conf:/Tracker"&gt;&lt;/endpoint&gt;
     &lt;/call&gt;
     &lt;log level="full"&gt;&lt;/log&gt;
  &lt;/sequence&gt;
  </code></pre>
  
  <p>Thanks a lot</p>