• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get a web service client to throw the exception I want (using jax-ws, wsdl and netbeans).

 
Michael Flower
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="https://wsweb0283.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="https://wsweb0283.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="https://wsweb0283.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx">
<s:element name="FaultMessage">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="faultcode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="faultString" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="faultactor" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CONENEventFinal">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CONEN_ID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AGS" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="FINAL_REPORT" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="EVENT_END" type="s:dateTime" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Response_Info_CO">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CONEN_ID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CONEN_URL_LINK" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="SUMMARY_INFO" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="CONENEventFinalResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CONENEventFinalResult" type="tns:Response_Info_CO" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="FaultException">
<wsdl:part name="fault" element="tns:FaultMessage" />
</wsdl:message>
<s:element name="CONENEventFinal">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CONEN_ID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AGS" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="FINAL_REPORT" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="EVENT_END" type="s:dateTime" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CONENEventFinalResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CONENEventFinalResult" type="tns:Response_Info_CO" />
</s:sequence>
</s:complexType>
</s:element>
<wsdl:message name="CONENEventFinalSoapIn">
<wsdl:part name="parameters" element="tns:CONENEventFinal" />
</wsdl:message>
<wsdl:message name="CONENEventFinalSoapOut">
<wsdl:part name="parameters" element="tns:CONENEventFinalResponse" />
</wsdl:message>
<wsdl:portType name="CONENWebServiceSoap">
<wsdlperation name="CONENEventFinal">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This method call will CONEN event</wsdl:documentation>
<wsdl:input message="tns:CONENEventFinalSoapIn" />
<wsdlutput message="tns:CONENEventFinalSoapOut" />
<wsdl:fault message="tns:FaultException" name="FaultException" />
</wsdlperation>
</wsdl:portType>
<wsdl:binding name="CONENWebServiceSoap" type="tns:CONENWebServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdlperation name="CONENEventFinal">
<soapperation soapAction="https://wsweb0283.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx/CONENEventFinal" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdlutput>
<soap:body use="literal" />
</wsdlutput>
<wsdl:fault name="FaultException">
<soap:fault name="FaultException" use="literal" />
<!--<soap:fault use="literal" />-->
</wsdl:fault>
</wsdlperation>
</wsdl:binding>
<wsdl:binding name="CONENWebServiceSoap12" type="tns:CONENWebServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdlperation name="CONENEventFinal">
<soap12peration soapAction="https://wsweb0283.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx/CONENEventFinal" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdlutput>
<soap12:body use="literal" />
</wsdlutput>
<wsdl:fault name="FaultException">
<soap12:fault name="FaultException" use="literal" />
</wsdl:fault>
</wsdlperation>
</wsdl:binding>
<wsdl:service name="CONENWebService">
<wsdl:port name="CONENWebServiceSoap" binding="tns:CONENWebServiceSoap">
<soap:address location="http://wsfile0019.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx" />
</wsdl:port>
<wsdl:port name="CONENWebServiceSoap12" binding="tns:CONENWebServiceSoap12">
<soap12:address location="http://wsfile0019.srv.dir.xyz.com/CONENWS/CONENWSDL.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

When calling the CONENWebService.CONENEventFinal(null, null, null, null) the web service will respond with a soap:fault message.
I was hoping that my Exception FaultException would be thrown. It isn't however. It appears that the CONENEventFinal doesn't recognise the FaultMessage defined.
I was hoping that the JAX-WS infrastructure would see the soap:fault message coming back and cause a FaultException to be thrown.

Can someone see what I have done wrong?

...mcf
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!