axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamal Advani" <kamal.adv...@gmail.com>
Subject WSDL Fault type not being deserialized properly
Date Tue, 10 Jul 2007 02:07:04 GMT
Hi all,

We're using Axis 1.4.  The service we're attempting to connect to throws
various faults defined in the WSDL. All the faults are properly generated as
Java classes. Currently, we have a test service (also generated by Axis)
that simulates these faults by throwing them on specific inputs to the
service. Here's an extract of the fault definitions in the WSDL:

----------------------
            <xsd:complexType name="FaultType">
                <xsd:sequence>
                    <xsd:element type="xsd:int" name="FaultID"/>
                    <xsd:element type="xsd:string" name="MessageText"/>
                    <xsd:element name="Severity">
                        <xsd:simpleType>
                            <xsd:restriction base="xsd:string">
                                <xsd:enumeration value="Warning"/>
                                <xsd:enumeration value="Error"/>
                            </xsd:restriction>
                        </xsd:simpleType>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
            <complexType name="processELFDataFormatFaultType">
                <complexContent>
                    <extension base="impl:FaultType"/>
                </complexContent>
            </complexType>
            ... <!-- other specific Faults -->
----------------------

The generated FaultType class has the following constructor:


----------------------
    public FaultType(
           int faultID,
           java.lang.String messageText,
           au.gov.vic.sro.conveyancing.ws.lodgement.v1_1.FaultTypeSeverityseverity)
{
        this.faultID = faultID;
        this.messageText = messageText;
        this.severity = severity;
    }
----------------------

The test service gets invoked, checks the input parameter, and does say:

----------------------
throw new  ProcessELFDataFormatFaultType(1, "Data Format Fault",
FaultTypeSeverity.fromValue(FaultTypeSeverity._Error));
----------------------


The invoker is then able to catch a generic FaultType (which extends
AxisFault) exception, however the details are not mapped in the way it was
thrown, here's a trace on the client/invoker's side:

----------------------
AxisFault
faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString:
faultActor:
faultNode:
faultDetail:
    {}au.gov.vic.sro.conveyancing.ws.lodgement.v1_1.FaultType:<ns1:FaultID
xmlns:ns1="
http://www.e-business.sro.vic.gov.au/ConveyancingServices/services/v1.1">1</ns1:FaultID><ns2:MessageText
xmlns:ns2="
http://www.e-business.sro.vic.gov.au/ConveyancingServices/services/v1.1">Data
Format Fault</ns2:MessageText><ns3:Severity xmlns:ns3="
http://www.e-business.sro.vic.gov.au/ConveyancingServices/services/v1.1
">Error</ns3:Severity>
    {
http://xml.apache.org/axis/}exceptionName:au.gov.vic.sro.conveyancing.ws.lodgement.v1_1.ProcessELFDataFormatFaultType
    {http://xml.apache.org/axis/}hostname:B003169

    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1263)
    at org.apache.axis.message.SOAPFaultBuilder.createFault(
SOAPFaultBuilder.java:182)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(
SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(
DeserializationContext.java:1087)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
----------------------


In particular I am interested in fault.getMessageText() ("Data Format Fault"
in the example above) - however this returns null in the mapped (/caught)
fault - instead all the necessary FaultType details are left as nodes in
fault.getFaultDetails().

Any particular configuration detail I am missing?

If this is expected behaviour, is there a generic/portable/idiomatic way to
deserialize the nodes into a FaultType object to retrieve it's message text?

Please let me know if you need more information.

Thanks.


Regards,
Kamal

Mime
View raw message