Tuesday, March 18, 2014

Target Endpoint Validation Caveats

Validation failures in target endpoint xml files result in error messages that do not detail the root cause. In proxy xml files single quote around conditions is not valid. Consider the following example
<TargetEndpoint name="routetobackend">
  <Flows>
        <Flow name="login">
            <Request>
               <Step>
                    <Name>extract_accept_header</Name>
                </Step>
                 <Step>
                    <Condition>!(local_accept := 'application/json') </Condition>
                    <Name>fault_accept_json_not_found</Name>
                </Step>
            </Request>
            <Response/>
        </Flow>
  </Flows>
  <HTTPTargetConnection>
      <LoadBalancer>
         <Algorithm>RoundRobin</Algorithm>
         <RetryEnabled>true</RetryEnabled>
         <Server name="Some_Target">
            <IsEnabled>true</IsEnabled>
         </Server>
      </LoadBalancer>
    <Path>/some/path</Path>
  </HTTPTargetConnection>
</TargetEndpoint>
The single quote around application/json in the Condition tag is not valid. In this case, the error is obtained during runtime only (not deploy time) even though this is a static validation issue. The runtime error is as follows.

{"fault":{"faultstring":"Unable to send the request to the identified target","detail":{"errorcode":"messaging.runtime.TargetMissing"}}}

As i mentioned earlier the error is not descriptive of the root cause. Hence, in case of routing errors like above, its good to do a recheck on the content of the target endpoint xml before looking into network issues related to the backend.

3 comments:

  1. Just to add something, I had the same issue and it was due to a being put in the flow (Steps) with line breaks... apparently it all has to be on a single line

    ReplyDelete
  2. I found a related interesting caveat to note: http://stackoverflow.com/questions/23914594/what-causes-a-the-entity-name-must-immediately-follow-the-in-the-entity-er

    ReplyDelete