Including SOAP Headers into SOAP Envelope using XSL Script

xsl-code.txtsample-soap.txtHi All,

I am trying to insert a SOAP header into a SOAP envelope given as a payload in Assign Message policy. I am using a XSL transform policy to achieve this.

I am attaching the sample SOAP Payload and sample XSL code which I am using for testing.

When I am executing the proxy from my cloud environment(17.01) ,its executing with the desired result. But when I am trying this in on-perm(4.16.01.01), I am not able to get the desired result. Please help me with this.

Solved Solved
1 6 1,484
1 ACCEPTED SOLUTION

I don't know what to tell you. Your XSL works for me in the Apigee Edge cloud, exactly as expected. I cannot imagine why a simple XSL like that is not functioning as you expect in the Edge cloud.

In my experience, when things don't make sense, then it's time to question your assumptions.

So here's what I suggest . Check all of the assumptions you've made.

  • Do you really have that exact XSL in the cloud version of the proxy?
  • Is the cloud version of the proxy deployed? Is the correct REVISION of the cloud proxy deployed? You may want to undeploy all, and redeploy, to make sure. Sometimes the wrong version of a proxy is listening. What I like to do is undeploy the thing that I suppose is handling my request, then invoke the request. If I see a response, it means SOMETHING is still deployed and handling the request.
  • Are you sending in the appropriate content-type? The XSL policy will not execute if you have a non-XML content-type.
  • Are you sending in a properly formatted SOAP message with the correct XML namespaces?

If all of that checks out , then try importing + deploying the attached proxy bundle in your organization. Invoke it like this:

curl -i https://ORG-ENV.apigee.net/harini-1/t1 -H content-type:text/xml \
 -d '<soap:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header>
    <wsse:Security>
      <wsu:Timestamp wsu:Id="Timestamp-7cd6d5e5">
        <wsu:Created>2009-08-26</wsu:Created>
      </wsu:Timestamp>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <GetProxy>
      <ProxiesList/>
    </GetProxy>
  </soap:Body>
</soap:Envelope>
'

You should see a complete SOAP request on output, with your desired element injected. For me it looks like this:

<soap:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-7cd6d5e5">
            <wsu:Created>2009-08-26</wsu:Created>
         </wsu:Timestamp>
      </wsse:Security>
      <ut:reqCode xmlns:ut="temp.org">
         <ut:reqInfo>1490817647202</ut:reqInfo>
      </ut:reqCode>
   </soap:Header>
  <soap:Body>
      <GetProxy>
         <ProxiesList/>
      </GetProxy>
  </soap:Body>
</soap:Envelope>


If not, then... you need to contact Apigee Edge support.

apiproxy-harini-1-20170327-141247.zip

View solution in original post

6 REPLIES 6

Hi, sorry your question has gone unattended for so long. Are you still having this problem?

If so, you said "I'm not able to get the desired result." OK, but what result ARE you getting?

Can you provide more details?

Also, I suggest that you get current on your OPDK. I think that 4.16.01 is going out of support, and at the very least you need to get the latest patch.

The result which I am getting in the on-perm is the same soap data without the <ut:reqCode> header attached.

Hi Dino

I am still facing this problem only. My output must have a extra tag <ut:reqCode> under<soap:Header> which I am trying to include using the xsl code attached above. When I am trying this on my on-perm version I am getting the result with <ut:reqCode> attached.But I am able to get the correct output in my cloud. Kindly help me with this.

I don't know what to tell you. Your XSL works for me in the Apigee Edge cloud, exactly as expected. I cannot imagine why a simple XSL like that is not functioning as you expect in the Edge cloud.

In my experience, when things don't make sense, then it's time to question your assumptions.

So here's what I suggest . Check all of the assumptions you've made.

  • Do you really have that exact XSL in the cloud version of the proxy?
  • Is the cloud version of the proxy deployed? Is the correct REVISION of the cloud proxy deployed? You may want to undeploy all, and redeploy, to make sure. Sometimes the wrong version of a proxy is listening. What I like to do is undeploy the thing that I suppose is handling my request, then invoke the request. If I see a response, it means SOMETHING is still deployed and handling the request.
  • Are you sending in the appropriate content-type? The XSL policy will not execute if you have a non-XML content-type.
  • Are you sending in a properly formatted SOAP message with the correct XML namespaces?

If all of that checks out , then try importing + deploying the attached proxy bundle in your organization. Invoke it like this:

curl -i https://ORG-ENV.apigee.net/harini-1/t1 -H content-type:text/xml \
 -d '<soap:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header>
    <wsse:Security>
      <wsu:Timestamp wsu:Id="Timestamp-7cd6d5e5">
        <wsu:Created>2009-08-26</wsu:Created>
      </wsu:Timestamp>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <GetProxy>
      <ProxiesList/>
    </GetProxy>
  </soap:Body>
</soap:Envelope>
'

You should see a complete SOAP request on output, with your desired element injected. For me it looks like this:

<soap:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-7cd6d5e5">
            <wsu:Created>2009-08-26</wsu:Created>
         </wsu:Timestamp>
      </wsse:Security>
      <ut:reqCode xmlns:ut="temp.org">
         <ut:reqInfo>1490817647202</ut:reqInfo>
      </ut:reqCode>
   </soap:Header>
  <soap:Body>
      <GetProxy>
         <ProxiesList/>
      </GetProxy>
  </soap:Body>
</soap:Envelope>


If not, then... you need to contact Apigee Edge support.

apiproxy-harini-1-20170327-141247.zip

Thank you Dino..I will try executing as you suggested.