Friday, September 14, 2012

SOAP envelope/body/header manipulation in BPEL 11g

We had some stringent requirement for one of the SOAP based web service, e.g.
  • custom soap header element needed to have mustUnderstand flag. 
  • In soap body we had some xsd:any with no namespace, and it is very hard to work with XSD any in BPEL 
So here is the approach which worked like a charm, and probably can be used where we need to have full control over SOAP envelope. Basically, use HTTP binding. Steps:

  • Created HTTP Binding as following



  •  Assigned entire soap envelope as I wanted to envelope variable using oraext:parseEscapedXML
oraext:parseEscapedXML('

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prov="http://xmlns.oracle.com/OIM/provisioning">
   <soapenv:Header>
      <wsa1:OIMUser soapenv:mustUnderstand="0" xmlns:wsa1="http://xmlns.oracle.com/OIM/provisioning">
         <wsa1:OIMUserId>**</wsa1:OIMUserId>
         <wsa1:OIMUserPassword>**</wsa1:OIMUserPassword>
      </wsa1:OIMUser>
   </soapenv:Header>
   <soapenv:Body>
      <m:processRequest xmlns:m="http://xmlns.oracle.com/OIM/provisioning">
         <sOAPElement>
            <addRequest returnData="everything" xmlns="urn:oasis:names:tc:SPML:2:0" xmlns:dsml="urn:oasis:names:tc:DSML:2:0:core">
             </data>
            </addRequest>
         </sOAPElement>
      </m:processRequest>
   </soapenv:Body>
</soapenv:Envelope>

')

  •  Upon return we can directly get Body or entire Envelope using
ora:getContentAsString($envelope/ns1:Body)

Code Download