cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tolan, Michael E" <meto...@cbs.com>
Subject Getting SoapFault instead of specified exception
Date Wed, 03 Oct 2007 17:26:13 GMT
I'm having an issue that I think seems similar to CXF-1028. 

 

I'm using CXF-2.0.2 to deploy a JAX-WS service through an Apache Tomcat
instance running CXF-Servlet.

 

I'm building a simple java-first registration/login service, and
attempting my methods to throw service-specific exceptions by using
Exception classes with the @WebFault annotation. However, the client is
seeing a generic SoapFault, albeit with some of my exception-specific
data in the details section.

 

I'll be the first to admit that I'm probably doing something wrong, I've
been trying to get this to work for about a week (part of the time using
2.0.1). If there's any more information that would be helpful. I'm happy
to provide it, just don't want to create an overwhelmingly lengthy email
if I'm messing up something obvious.

 

Thanks for any help,

-Mike

 

 

Soap Request:

------------------------------------

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://soap.webservices.bos.foo.com/">

   <soapenv:Header/>

   <soapenv:Body>

      <soap:register>

         <username>Mike</username>

         <password>mike</password>

         <confirm_password>mike2</confirm_password>

      </soap:register>

   </soapenv:Body>

</soapenv:Envelope>

 

 

Soap Response:

--------------------------------------

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

   <soap:Body>

      <soap:Fault>

         <faultcode>soap:Server</faultcode>

         <faultstring>Fault occurred while processing.</faultstring>

         <detail>

            <ns2:faultDetail xsi:nil="true"
xmlns:ns2="http://soap.webservices.bos.foo.com/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

         </detail>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

 

Exception Class:

---------------------------------------

package com.foo.bos.exception;

 

import com.foo.bos.data.FaultDetail;

import javax.xml.ws.WebFault;

 

@WebFault(name="faultDetail",targetNamespace="http://soap.webservices.bo
s.foo.com/",faultBean="com.foo.bos.data.FaultDetail")

public class PasswordMismatchException extends Exception {

 

                private FaultDetail details;

 

                public PasswordMismatchException() {super();}

                public FaultDetail getFaultInfo() {return details;}

                public PasswordMismatchException(String msg, FaultDetail
details) {

                                super(msg);

                                this.details = details;

                }

                public PasswordMismatchException(String msg, FaultDetail
details, Throwable t) {

                                super(msg,t);

                                this.details = details;

                }

}

 

 

Simplified Generated WSDL:

-------------------------------------

<?xml version="1.0" encoding="utf-8"?><wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://soap.webservices.bos.foo.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="LoginServiceImplService"
targetNamespace="http://soap.webservices.bos.foo.com/">

 

<wsdl:types>

  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://soap.webservices.bos.foo.com/"
xmlns:tns="http://soap.webservices.bos.foo.com/">

  <xs:element name="faultDetail">

    <xs:complexType>

      <xs:sequence>

      <xs:element name="minor" type="xs:short"/>

      <xs:element name="major" type="xs:short"/>

      </xs:sequence>

    </xs:complexType>

  </xs:element>

 

  <xs:element name="register" type="tns:register"/>

    <xs:complexType name="register">

      <xs:sequence>

        <xs:element minOccurs="0" name="username" type="xs:string"/>

        <xs:element minOccurs="0" name="password" type="xs:string"/>

        <xs:element minOccurs="0" name="confirm_password"
type="xs:string"/>

      </xs:sequence>

    </xs:complexType>

 

  <xs:element name="registerResponse" type="tns:registerResponse"/>

  <xs:complexType name="registerResponse">

    <xs:sequence>

      <xs:element minOccurs="0" ref="tns:sessionId"/>

    </xs:sequence>

  </xs:complexType>

</xs:schema>

</wsdl:types>

 

<wsdl:message name="PasswordMismatchException">

  <wsdl:part element="tns:faultDetail" name="PasswordMismatchException">

</wsdl:part>

</wsdl:message>

  <wsdl:message name="registerResponse">

    <wsdl:part element="tns:registerResponse" name="result">

    </wsdl:part>

  </wsdl:message>

 

  <wsdl:message name="register">

    <wsdl:part element="tns:register" name="parameters">

    </wsdl:part>

  </wsdl:message>

 

  <wsdl:portType name="LoginService">

    <wsdl:operation name="register">

      <wsdl:input message="tns:register" name="register"></wsdl:input>

      <wsdl:output message="tns:registerResponse"
name="registerResponse"></wsdl:output>

      <wsdl:fault message="tns:PasswordMismatchException"
name="PasswordMismatchException">

    </wsdl:fault>

    </wsdl:operation>

 

  </wsdl:portType>

  <wsdl:binding name="LoginServiceImplServiceSoapBinding"
type="tns:LoginService">

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

 

    <wsdl:operation name="register">

      <soap:operation soapAction="" style="document"/>

      <wsdl:input name="register">

        <soap:body use="literal"/>

      </wsdl:input>

 

      <wsdl:output name="registerResponse">

        <soap:body use="literal"/>

      </wsdl:output>

      <wsdl:fault name="PasswordMismatchException">

        <soap:fault name="PasswordMismatchException" use="literal"/>

      </wsdl:fault>

    </wsdl:operation>

 

  </wsdl:binding>

  <wsdl:service name="LoginServiceImplService">

 

    <wsdl:port binding="tns:LoginServiceImplServiceSoapBinding"
name="LoginServiceImplPort">

      <soap:address location="http://serveraddress/loginService"/>

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message