axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrián Cuartero <adriancuart...@yahoo.es>
Subject Re: Capture custom exception
Date Tue, 25 Mar 2008 18:05:42 GMT
Thanks all for the fast a good answers but i haven't solved my problem.

i'm trying to find a sub of an axisfault but when i try to getCause in the client i allways
recive null.

Let me post the code to ask a little help again.

This is the exception

package ws.example;

public class MyException extends java.lang.Exception implements java.io.Serializable {
    private int errorCode;

    private String errorDescription;


    public MyException(int errorCode, String errorDescription) {
        this.errorCode = errorCode;
        this.errorDescription = errorDescription;
    }
    public int getErrorCode(){
        return errorCode;
    }
    public String getErrorDescription(){
        return errorDescription;
    }
    public void setErrorDescription(int ec){
        errorCode=ec;
    }
    public void setErrorCode(String str){
        errorDescription=str;
    }
}

An here the server

package ws.example;

import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
public class Server{

    public void llamada()throws AxisFault{
        final MyException miprueba=new MyException(2,"Esto es una prueba");
        System.out.println("llega");
        AxisFault fault= new AxisFault("Funciona",miprueba);
        throw fault;
    }
}

i've tryed with makeFault with the same result.

and here the autogenerated wsdl

<?xml version="1.0" encoding="UTF-8"?>

    <wsdl:types>
        
    <xs:complexType name="Exception">
        <xs:sequence>
            <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
    </wsdl:types>
    <wsdl:message name="llamadaRequest"/>
    <wsdl:message name="llamadaResponse"/>
    <wsdl:portType name="ServerPortType">
        <wsdl:operation name="llamada">
            <wsdl:input message="axis2:llamadaRequest" wsaw:Action="urn:llamada"/>
            <wsdl:output message="axis2:llamadaResponse" wsaw:Action="urn:llamadaResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ServerSOAP11Binding" type="axis2:ServerPortType">
        
        <wsdl:operation name="llamada">
            <soap:operation soapAction="urn:llamada" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="ServerSOAP12Binding" type="axis2:ServerPortType">
        
        <wsdl:operation name="llamada">
            <soap12:operation soapAction="urn:llamada" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="ServerHttpBinding" type="axis2:ServerPortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="llamada">
            <http:operation location="Server/llamada"/>
            <wsdl:input>
                <mime:content type="text/xml" part="llamada"/>
            </wsdl:input>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Server">
        <wsdl:port name="ServerSOAP11port_http" binding="axis2:ServerSOAP11Binding">
            http://localhost:8080/axis2/services/Server"/>
        </wsdl:port>
        <wsdl:port name="ServerSOAP12port_http" binding="axis2:ServerSOAP12Binding">
            http://localhost:8080/axis2/services/Server"/>
        </wsdl:port>
        <wsdl:port name="ServerHttpport" binding="axis2:ServerHttpBinding">
            http://localhost:8080/axis2/services/Server"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

I don't know why the wsdl desn't use the wsdl:fault label. Must use?

Thanks a lot

----- Mensaje original ----
De: Michele Mazzucco <Michele.Mazzucco@ncl.ac.uk>
Para: axis-user@ws.apache.org
Enviado: martes, 25 de marzo, 2008 11:17:19
Asunto: Re: Capture custom exception

You can use new AxisFault.makeFault(customException) on the server side
and retrieve your custom fault with axisFault.getCause()


Michele


On 24 Mar 2008, at 19:47, Adrián Cuartero wrote:
> Hi all
>
> I keep trying throwing a custom exception and i've read there's a  
> problem capturing this exception in the client side.
>
> Anyone knows how to capture this custom exceptions?
>
> Thanks
>
>
> Enviado desde Correo Yahoo!
> Disfruta de una bandeja de entrada más inteligente..


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org







       
______________________________________________ 
¿Con Mascota por primera vez? Sé un mejor Amigo. Entra en Yahoo! Respuestas http://es.answers.yahoo.com/info/welcome
Mime
View raw message