axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom O'Neil <kingofthesqu...@yahoo.com>
Subject Handling custom Exceptions?
Date Tue, 13 Aug 2002 21:18:44 GMT
I'm having difficulty properly generation custom
exceptions for my web service in Axis beta 3. The
exception itself is quite basic (see below). When I
use Java2WSDL, the WSDL file generated seems to
properly reflect the custom exception (the "fault"
elements are all present). However, my client app
receives it as an AxisFault, which faultCode of
"ns1:Server.userException". And when I use the
"http://host/services/service?wsdl" option to
auto-generate the WSDL from the server itself, the
custom exception does not appear. Is this a bug, or is
there a way around this? Please respond to
kingofthesquids@yahoo.com. Thanks.

------------ EXCEPTION CLASS ----------------------

public class UnauthorizedException extends Exception
{
    private String message;
    public UnauthorizedException()
    {
        super();
    }
    public UnauthorizedException(String message)
    {
        this.message = message;
    }
    public void setMessage(String message)
    {
        this.message = message;
    }
    public String getMessage()
    {
        return message;
    }
}

------------ WSDL FROM Java2WSDL -------------------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://soap.util.backoffice.edo.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://soap.util.backoffice.edo.com-impl"
xmlns:intf="http://soap.util.backoffice.edo.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <schema
targetNamespace="http://soap.util.backoffice.edo.com"
xmlns="http://www.w3.org/2001/XMLSchema">
   <import
namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_soapenc_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType"
wsdl:arrayType="soapenc:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
   <element name="ArrayOf_soapenc_string"
nillable="true" type="intf:ArrayOf_soapenc_string"/>
   <complexType name="UnauthorizedException">
    <sequence>
     <element name="message" nillable="true"
type="soapenc:string"/>
    </sequence>
   </complexType>
   <element name="UnauthorizedException"
nillable="true" type="intf:UnauthorizedException"/>
  </schema>
 </wsdl:types>

   <wsdl:message name="getTemplateNamesResponse">

      <wsdl:part name="return"
type="intf:ArrayOf_soapenc_string"/>

   </wsdl:message>

   <wsdl:message name="UnauthorizedException">

      <wsdl:part name="fault"
type="intf:UnauthorizedException"/>

   </wsdl:message>

   <wsdl:message name="getTemplateNamesRequest">

      <wsdl:part name="userName"
type="soapenc:string"/>

      <wsdl:part name="password"
type="soapenc:string"/>

   </wsdl:message>

   <wsdl:portType name="PrintTemplates">

      <wsdl:operation name="getTemplateNames"
parameterOrder="userName password">

         <wsdl:input
message="intf:getTemplateNamesRequest"
name="getTemplateNamesRequest"/>

         <wsdl:output
message="intf:getTemplateNamesResponse"
name="getTemplateNamesResponse"/>

         <wsdl:fault
message="intf:UnauthorizedException"
name="UnauthorizedException"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="PrintTemplatesSoapBinding"
type="intf:PrintTemplates">

      <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getTemplateNames">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getTemplateNamesRequest">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://soap.util.backoffice.edo.com"
use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getTemplateNamesResponse">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://soap.util.backoffice.edo.com"
use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="PrintTemplatesService">

      <wsdl:port
binding="intf:PrintTemplatesSoapBinding"
name="PrintTemplates">

         <wsdlsoap:address
location="http://localhost:8080/PrintWizard/services/PrintTemplates"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

--------- WSDL FROM SERVER "service?wsdl" ----------

 <?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions
targetNamespace="http://soap.util.backoffice.edo.com"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://soap.util.backoffice.edo.com-impl"
xmlns:intf="http://soap.util.backoffice.edo.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema
targetNamespace="http://soap.util.backoffice.edo.com"
xmlns="http://www.w3.org/2001/XMLSchema">
  <import
namespace="http://schemas.xmlsoap.org/soap/encoding/"
/> 
- <complexType name="ArrayOf_soapenc_string">
- <complexContent>
- <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]" /> 
  </restriction>
  </complexContent>
  </complexType>
  <element name="ArrayOf_soapenc_string"
nillable="true" type="intf:ArrayOf_soapenc_string" /> 
  </schema>
  </wsdl:types>
- <wsdl:message name="getTemplateNamesResponse">
  <wsdl:part name="return"
type="intf:ArrayOf_soapenc_string" /> 
  </wsdl:message>
- <wsdl:message name="getTemplateNamesRequest">
  <wsdl:part name="userName" type="xsd:string" /> 
  <wsdl:part name="password" type="xsd:string" /> 
  </wsdl:message>
- <wsdl:portType name="PrintTemplates">
- <wsdl:operation name="getTemplateNames"
parameterOrder="userName password">
  <wsdl:input message="intf:getTemplateNamesRequest"
name="getTemplateNamesRequest" /> 
  <wsdl:output message="intf:getTemplateNamesResponse"
name="getTemplateNamesResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="PrintTemplatesSoapBinding"
type="intf:PrintTemplates">
  <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="getTemplateNames">
  <wsdlsoap:operation soapAction="" /> 
- <wsdl:input name="getTemplateNamesRequest">
  <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://soap.util.backoffice.edo.com"
use="encoded" /> 
  </wsdl:input>
- <wsdl:output name="getTemplateNamesResponse">
  <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://soap.util.backoffice.edo.com"
use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="PrintTemplatesService">
- <wsdl:port binding="intf:PrintTemplatesSoapBinding"
name="PrintTemplates">
  <wsdlsoap:address
location="http://localhost:8080/PrintWizard/services/PrintTemplates"
/> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

=====
--- -  ---  - --  --- ----- -  -   ----- -- --  -  -   ----
 Tom O'Neil <kingofthesquids@yahoo.com> 
--- -  ---  - --  --- ----- -  -   ----- -- --  -  -   ----

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

Mime
View raw message