Error while adding additional SOAP Operations under SOAP Passthrough Proxy

I have created a Proxy (Pass through SOAP Policy) and want to add operations from other SOAP Services that have same Uri path.

To do that added JS Policy at request flow with this -

 var soap_action = context.getVariable('request.header.SOAPAction');
 context.setVariable("message.soapaction", soap_action);

Created additional TargetEndpoint in target, added new RouteRule (before default) in Proxy -

    <RouteRule name="ABCService">
        <Condition>service.soapaction = "ABCoperation1"</Condition>
        <TargetEndpoint>ABCService</TargetEndpoint>
    </RouteRule>

Removed ReturnWSDL GET operation and corresponding policy as i don't need that feature.

Also added a Flow (on same pattern as operations in default SOAP Service, tried both operation = ".." and below condition) -

        <Flow name="ABCoperation1">
            <Description>ABCoperation1</Description>
            <Request/>
            <Response/>
            <Condition>(proxy.pathsuffix MatchesPath "/") and (request.verb = "POST") and (message.soapaction = "ABCoperation1")</Condition>
        </Flow>

when i execute default WSDL operations work fine , but new operation returns error -

{"Envelope":{"encodingStyle":"http:\/\/schemas.xmlsoap.org\/soap\/encoding\/","Body":{"Fault":{"faultcode":"soap:Server","faultstring":"Header name cannot be empty","faultactor":{},"detail":{"source":{"errorcode":"protocol.http.EmptyHeaderName"}}}}}}

not sure which header it is complaining about...

Thanks

0 2 485
2 REPLIES 2

Requests are not even reaching the Proxy for manually added SOAP operation so it seems apigee router itself blocking it unless operation is one of those which got configured as part of initial Proxy setup(Operations as part of WSDL)

The Fault you showed is a JSON version of a SOAP message. The corresponding original SOAP message would be something like this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <soap:Fault>
    <faultcode>soap:Server</faultcode>
    <faultstring>Header name cannot be empty</faultstring>
    <detail>
      <source>
        <errorcode>protocol.http.EmptyHeaderName</errorcode>
      </source>
    </detail>
  </soap:Fault>
</soap:Envelope>

The fault is being issued by the backend system.

It seems the backend is complaining about a missing header. Probably a SOAP header - something required in the envelope. You need to consult the logs or documentation for that system to determine how to invoke it properly, which headers are required, and how to pass them.

It's too bad that the backend system doesn't specify which header is missing.

ps: the code you have that sets "message.soapaction" looks strange. I suggest that you change it.

The "message" variable in Apigee Edge refers to the ambient message, either a request or a response message depending on where in the proxy flow the access occurs. There are several "child" ob jects under "message", including content, header, queryparam, and others. For example, setting "message.header.foo" will set the header named "foo" on the ambient message.

I am not sure of the effect of setting "message.soapaction" - will it overwrite the ambient message? No-op? something else?

If you want to set a custom variable, choose a name prefix other than message. For example

context.setVariable('msg_soapaction', soapAction);

Even so, I don't know why you'd need that assignment at all, in JavaScript. You're just assigning the value of one variable to another. You could query the request header directly in the Condition for a routerule.

<Condition>request.header.soapaction = "ABCoperation1"</Condition>