Monday, March 7, 2011

ORAMED-01201 in XSL file due to getHeader function

Problem:

In one of our Oracle SOA Suite 11g project, our XSL file contained the following, which simply used the 11g header function "mhdr:getHeader" to read the incoming SOAP address:
<xsl:variable name="ReplyTo"
select='mhdr:getHeader("in.header.soap_headers/soap:header/wsa:ReplyTo/wsa:Address","soap=http://schemas.xmlsoap.org/soap/envelope/;wsa=http://www.w3.org/2005/08/addressing;")'/>
Upon execution, we received the following error on the console:
ORAMED-01201:[Error in transform operation]Error occurred while transforming payload using "xsl/Transformation1.xsl" for target part "parameters".Possible Fix:Review the XSL or source payload. Either the XSL defined does not match with the payload or payload is invalid. Cause:XML-22044: (Error) Extension function error: Error invoking 'getHeader':'javax.xml.xpath.XPathFunctionException'
The incoming header payload looked as follows, so there was nothing wrong with it:
<headers>
  <header>
    <a:MessageID>urn:uuid:56e575fb-14df-4c4a-993c-4f0216ed0980</a:MessageID>
  </header>
  <header>
    <a:ReplyTo>
      <a:Address>https://server/services/wsdl/HelloWorld?wsdl</a:Address>
    </a:ReplyTo>
  </header>
</headers>

We tried using the "getProperty" function instead to no success.


Solution:

Our usage of "getHeader" was not correct.

Incorrect:
<xsl:variable name="ReplyTo" select='mhdr:getHeader("in.header.soap_headers/soap:header/wsa:ReplyTo/wsa:Address","soap=http://schemas.xmlsoap.org/soap/envelope/;wsa=http://www.w3.org/2005/08/addressing;")'/>
Correct:
<xsl:variable name="ReplyTo" select= 'mhdr:getHeader("in.header.wsa_ReplyTo/wsa:ReplyTo/wsa:Address","wsa=http://www.w3.org/2005/08/addressing;")'/>

Applicable Versions:
  • Oracle SOA Suite 11g (11.1.1.x)

References:
  • http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10224/bp_appx_functs.htm#CHDECDHG


Ahmed Aboulnaga

No comments: