Monday, October 25, 2010

"ORAMED-01003:[Invalid assign source expression]Invalid source used while assigning"

Problem:

I did an "Assign Value" in a Mediator component as follows. Basically, what this does is use an XPath condition to choose from 1 of 2 endpoints and then override the endpointURI, thus mimicking dynamic routing.

From:
if ('1' = '1') then ' http://server1:8001/wsdl1' else ' http://server2:8001/wsdl2'
To:
property: endpointURI
Unfortunately, at runtime, I received the following error:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Header/>
  <env:Body>
    <env:Fault>
      <faultcode>env:Server</faultcode>
      <faultstring> oracle.tip.mediator.infra.exception.MediatorException: ORAMED-01003:[Invalid assign source expression]Invalid source used while assigning. Check if source expression are valid. ["if ('1' = '1') then '
http://server1:8001/wsdl1' else 'http://server2:8001/wsdl2'"]Possible Fix:Modify source for valid expression
      </faultstring>
      <faultactor/>
      <detail>
        <exception/>
      </detail>
    </env:Fault>
  </env:Body>
</env:Envelope>

Solution:

For some reason, the "Assign Values" field does not support certain XPath features, such as conditions.

To work around this, I moved the statement to my XSL as follows:
<xsl:choose>
  <xsl:when test="'1' = '1'">
    <xsl:variable name="LocationOut"
 select="mhdr:setProperty('out.property.endpointURI','http://server1:8001/wsdl1')"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="LocationOut"
 select="mhdr:setProperty('out.property.endpointURI','http://server2:8001/wsdl2')"/>
  </xsl:otherwise>
</xsl:choose>

Applicable Versions:
  • Oracle SOA Suite 11g (11.1.1.3)

No comments: