Following is an excerpt from JAX-RPC 1.1, Section 4.3.6 WSDL Fault. Based
upon this information, should I expect to see WSDL2Java generate the
InvalidTickerException class? It currently does not, or at least I have
not been able to get it to do so.
----
The following shows an example of the mapping of a wsdl:fault to a service
specific
Java exception. The wsdl:message has a single part of type xsd:string:
<!-- WSDL Extract -->
<message name=”InvalidTickerException”>
<part name=”tickerSymbol” type=”xsd:string”/>
</message>
<portType name=”StockQuoteProvider”>
<operation name=”getLastTradePrice” ...>
<input message=”tns:getLastTradePrice”/>
<output message=”tns:getLastTradePriceResponse”/>
<fault name=”InvalidTickerException”
message=”tns:InvalidTickerException”/>
</operation>
</portType>
The following is the Java service endpoint interface derived from the above
WSDL port
type definition. Note that the getLastTradePrice method throws the
InvalidTickerException based on the mapping of the corresponding
wsdl:fault:
package com.example;
public interface StockQuoteProvider extends java.rmi.Remote {
float getLastTradePrice(String tickerSymbol)
throws java.rmi.RemoteException,
com.example.InvalidTickerException;
}
In this example, the wsdl:fault element is mapped to a Java exception
com.example.
InvalidTickerException that extends the java.lang.Exception class. The name
of
Java exception is mapped from the name of the wsdl:message referenced by
the
message attribute of the wsdl:fault element. The following code snippet
shows the
mapped exception.
package com.example;
public class InvalidTickerException extends java.lang.Exception {
public InvalidTickerException(String tickerSymbol) { ... }
public getTickerSymbol() { ... }
}
__