Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding a custom interceptor with SOAP Web Service MULE
    primarykey
    data
    text
    <p>I'am using Mule Community Edition 3.4. I have a problem with the UntilSuccessful component. The scenario is now exposed: I have a flow composed by a UntilSuccessful component in which there's a SOAP component that makes a request to a Web Service. In this flow there is an ExcpetionStrategy, too. The problem that I have is that when an exception occurs inside the UntilSuccessful (i.e in the SOAP component) the ExcpetionStrategy is not able to handle it because it (the Exception thrown) is handled by some mechanism inside the UntilSuccessful component. Because I need to handle the Exception in the ExcpetionStrategy, I thought to build a custom outbound interceptor (inside the SOAP component) that intercept the SOAP response (an exception if it's thrown) and that is able to throw an Exception in order to trigger the ExcpetionStrategy. Could anyone help me with this problem? I tried to read the documentation but it is sparse and does not explain very well how to build a custom outbound exception. What I would to do is to save somewhere the name of Exception thrown (i.e if server thrown a NumberFormatException, I would save its name somewhere in order to use it in the ExceptionStrategy) </p> <p>Below you can see a snippet of mule configuration file: </p> <pre><code>&lt;flow name="ProvaClient" doc:name="ProvaClient"&gt; &lt;quartz:inbound-endpoint jobName="TalendJob" repeatInterval="5000" repeatCount="0" responseTimeout="10000" doc:name="Quartz"&gt; &lt;quartz:event-generator-job&gt; &lt;quartz:payload&gt;error&lt;/quartz:payload&gt; &lt;/quartz:event-generator-job&gt; &lt;/quartz:inbound-endpoint&gt; &lt;object-to-string-transformer doc:name="Object to String"/&gt; &lt;until-successful objectStore-ref="OS_Bean" maxRetries="2" secondsBetweenRetries="2" doc:name="Until Successful" deadLetterQueue-ref="myQueue"&gt; &lt;processor-chain doc:name="Processor Chain: Wait For Web Service Response"&gt; &lt;processor-chain doc:name="Processor Chain: Web Service"&gt; &lt;cxf:jaxws-client operation="getCode" clientClass="it.aizoon.prova.client.ProvaService" port="ProvaPort" enableMuleSoapHeaders="true" doc:name="SOAP"&gt; &lt;/cxf:jaxws-client&gt; &lt;http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="service/prova" method="POST" doc:name="HTTP"/&gt; &lt;/processor-chain&gt; &lt;logger message="PAYLOAD: #[payload]" level="INFO" doc:name="Logger"/&gt; &lt;/processor-chain&gt; &lt;/until-successful&gt; &lt;catch-exception-strategy doc:name="Catch Exception Strategy"&gt; &lt;!-- &lt;processor ref="myExceptionHandler_id"/&gt; --&gt; &lt;logger message="EXCEPTION STRATEGY" level="INFO" doc:name="Logger"/&gt; &lt;/catch-exception-strategy&gt; &lt;/flow&gt; </code></pre> <p>Here you can see the server which exposes a web service: </p> <pre><code>&lt;flow name="provaServer" doc:name="provaServer"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" doc:name="HTTP" host="localhost" path="service/prova" port="8081"/&gt; &lt;logger message="SERVER" level="INFO" doc:name="Logger"/&gt; &lt;cxf:jaxws-service serviceClass="it.aizoon.prova.Prova" doc:name="Process SOAP Request" /&gt; &lt;component class="it.aizoon.prova.ProvaImpl" doc:name="Java"/&gt; &lt;/flow&gt; </code></pre> <p>And here there is the ProvaImpl.java, the implementation of Web Service. How you can see, if the string passed as argument in getCode() function is error, an exception in thrown and I would that it is managed by the exception strategy defined in the client </p> <pre><code>@WebService(endpointInterface = "it.aizoon.prova.Prova", serviceName = "Prova") public class ProvaImpl implements Prova{ @Override public String getCode(String code) throws NumberFormatException{ // TODO Auto-generated method stub if(code.equals("error")) throw new NumberFormatException(); String str = "Andato a buon fine!"; return str; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload