Hi Setya,

The 'fault' in the java binding operation has to be mapped to a 'message' in
the WSDL.

The 'message' can contain a part with name 'fault' which is mapped to a user
defined Exception type.

Once you have this, WSIF will convert the Exception to a Fault and the
exception object can be retrieved from the Fault parts.

Hope it helps.

Thanks
Prakash

On Tue, May 25, 2010 at 5:06 AM, Setya <[email protected]> wrote:

>
> Hi all,
>
> From BPEL, I need to catch exceptions thrown by invocation to Java method
> via WSIF, but it always returns remoteFault instead. Is it possible at all
> ?
>
> Here's part my WSDL file:
>
> ...
>  <message name="RawMSISDNMessage">
>    <part name="rawMSISDN" type="xsd:string"/>
>  </message>
>  <message name="FormattedMSISDNMessage">
>    <part name="formattedMSISDN" type="xsd:string"/>
>  </message>
>
>  <message name="InvalidParameterException">
>    <part name="message" type="xsd:string"/>
>  </message>
>
>  <portType name="CommonUtilityPT">
>    <operation name="formatMSISDN">
>      <input name="FormatMSISDNRequest" message="tns:RawMSISDNMessage"/>
>      <output name="FormatMSISDNResponse"
> message="tns:FormattedMSISDNMessage"/>
>      <fault name="FormatMSISDNFault"
> message="tns:InvalidParameterException"/>
>    </operation>
>  </portType>
>  <binding name="JavaBinding" type="tns:CommonUtilityPT">
>    <java:binding/>
>    <format:typeMapping encoding="Java" style="Java">
>      <format:typeMap typeName="xsd:string" formatType="java.lang.String"/>
>    </format:typeMapping>
>    <operation name="formatMSISDN">
>      <java:operation methodName="formatMSISDN" methodType="static"
>                      parameterOrder="rawMSISDN"
> returnPart="formattedMSISDN"/>
>      <input name="FormatMSISDNRequest"/>
>      <output name="FormatMSISDNResponse"/>
>      <fault name="FormatMSISDNFault"/>
>    </operation>
>  </binding>
>  <service name="CommonUtility">
>    <port name="JavaPort" binding="tns:JavaBinding">
>      <java:address className="com.visitek.xlpoc.CommonUtil"/>
>    </port>
>  </service>
> ...
>
> And this is my Java class:
>
> public class InvalidParameterException extends Exception
> {
>  public InvalidParameterException(String string)
>  {
>    super(string);
>  }
> }
>
> public final class CommonUtil
> {
>  public static String formatMSISDN(String rawMSISDN) throws
> InvalidParameterException
>  {
>    throw new InvalidParameterException("test");
>
>    return "test2";
>  }
> }
>
> Any help would be greatly appreciated.
>
>
> Regards,
>
> Setya
> --
> View this message in context:
> http://old.nabble.com/Handling-Exception-When-Invoking-Java-Via-WSIF-tp28667535p28667535.html
> Sent from the WSIF - User mailing list archive at Nabble.com.
>
>

Reply via email to