Posted 03/11/2009 - 13:17 by john.crupi
Presto, specifically Enterprise Mashup Markup Language (EMML), has a pretty robust error handling facility. Here are three examples:
Example 1: In this example we mashup three services. But, we only need the first service to succeed, the other two are optional. The EMML below shows the EMML “onerror”at tribute set to “fail” or “continue”. “Fail” causes the mashup to fail if the service1 invoke fails. Service2 and service3’s onerror=”continue” causes the mashup to proceed without their results.The failure can be cause by a service failure, network failure or something in between.
<emml>
<parallel>
<invoke service=”service1” onerror=”fail” output=”result1” />
<invoke service=”service2” onerror=”continue” output=”result2” />
<invoke service=”service3” onerror=”continue” output=”result3” />
</parallel>
</emml>
Example 2: In this example, we mashup four services. We call them in parallel and set a two second timeout on each. If any of the services take longer than two seconds, the service call will abort. But, because onerror=”continue” the mashup ignores the timeout and continues. However, since service4 has onerror=”fail”, the whole mashup would fail if the service4 invocation exceeded two seconds.
<emml>
<parallel>
<invoke service=”service1” timeout=”2” onerror=”continue” output=”result1” />
<invoke service=”service2” timeout=”2 onerror=”continue” output=”result2” />
<invoke service=”service3” timeout=”2” onerror=”continue” output=”result3” />
<invoke service=”service4” timeout=”2” onerror=”fail” output=”result4” />
</parallel>
</emml>
Example 3: In this example, we invoke service1 and continue on an error. But, we also have a condition check against the implicit $faultcode so we can gracefully handle different error codes coming back from the server.
<emml>
<invoke service=”service1” onerror=”continue” output=”result1” /
<if condition="$faultcode = -1">
…
<elseif condition="$faultcode = 0">
</if>
</emml>
- Login or register to post comments
- Email this page
