Hi all and especially any Axis developers looking through these mails

I have posted this befor in a different format with no responce. It would 
appear that I have a problem nobody else has.

I have an existing EJB service that I am exposing as a web service via Axis. 
All the serializable types and custom exceptions thrown by the service are 
already defined.

I have created a WSDL file that represents the service and have used WSDL2java 
to create all the service classes. I do not use the serverside generated Stub 
just the Impl class that is referenced in the deploy.wsdd. 

All the method signatures created in the service PortType interface created by 
WSDL2java match the signatures of the EJB remote interface.

I also get WSDL2java to auto generate the JUnit test for the service and it has 
the relevent try catch blocks for the exceptions created. I hand modify this to 
pass relevent data to the Axis WebService and the hand modified Impl class 
delegates the calls to the EJB.

Most of the time this works fine. I can generate Exceptions from within the EJB 
and these are caught by the JUnit relevent test cases. I use tcpmon to monitor 
the SOAP requests travelling between the JUnit class acting as a WebService 
client and the Axis WebService that delegates the calls on.

HOWEVER, I have a situation where tcpmon identifies the correct fault being 
returned from the Axis WebService as generated by the EJB to the JUnit client 
as follows

HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset=utf-8
Date: Sat, 20 Mar 2004 10:44:45 GMT
Server: Apache Coyote/1.0
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
      <soapenv:Body>  
         <soapenv:Fault>   
            <faultcode>soapenv:Server.userException</faultcode>   
            
<faultstring>de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDExcepti
on: account number not found error in vi_csc_msisdn.vi_get_account_and_personid 
for msisdn =  ErrorCode = 600 ErrorMessage = No Account found   for this 
MSISDN :        ORA-01403: no data found</faultstring>   
            <detail>    
               <ns2:fault xsi:type="ns1:UnknownIDException" 
xmlns:ns1="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de"; 
xmlns:ns2="urn:ESelfcareSoap">     
                  <ns2:description 
xsi:type="xsd:string">msisdn</ns2:description>     
                  <ns2:message xsi:type="xsd:string">account number not found 
error in vi_csc_msisdn.vi_get_account_and_personid for msisdn =  ErrorCode = 
600 ErrorMessage = No   Account found   for this MSISDN :       ORA-01403: no 
data found</ns2:message>     
                  <ns2:sourceException xsi:nil="true"/>     
                  <ns2:type xsi:type="xsd:int">1</ns2:type>    
               </ns2:fault>   
            </detail>  
         </soapenv:Fault> 
      </soapenv:Body>
   </soapenv:Envelope>


As you can see the Exception/Fault returned to the JUnit Client from the Axis 
WebService is a 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDException.

But when Axis tries to deserialize the SOAP fault into an Axis Fault at the 
JUnit client the Axis Fault reports as follows:- 

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Invalid element in 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException - 
description
 faultActor: 
 faultNode: 
 faultDetail: 
        {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: 
Invalid element in 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException - 
description
        at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild
(BeanDeserializer.java:260)
        at org.apache.axis.encoding.DeserializationContextImpl.startElement
(DeserializationContextImpl.java:963)
...
etc...

A SAX exception has been created against a completely different exception i.e. 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException

The SAX exception states that it is unable to deserialize the description 
property into the 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException as I 
would expect because this exception has no such property defined BUT the 
de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDException does.

Both of these exceptions are defined in the method signature being called and 
both have relevent entries for the operation in the WSDL as follows :-

<operation name="barMsisdnLevel">
        <input message="tns:barMsisdnLevelRequest"/>
        <output message="tns:barMsisdnLevelResponse"/>
        <fault message="tns:OrderFailedException" 
name="OrderFailedException" /> 
        <fault message="tns:AccessDeniedException" 
name="AccessDeniedException" /> 
        <fault message="tns:UnknownIDException" name="UnknownIDException" /> 
</operation>

The exceptions do not inherit from each other but do share a common base blass 
that they both extend and this base class extends java.lang.Exception.

The relevent definitions of the exceptions within the WSDL are as follows :-

<!-- this is the common application exception base class and extends 
java.lang.Exception -->
<complexType name="ApplicationException">
<sequence>
  <element name="sourceException" nillable="true" type="xsd:anyType" /> 
  <element name="message" nillable="true" type="xsd:string" /> 
</sequence>
</complexType>

<complexType name="UnknownIDException">
<complexContent>
<extension base="ex1:ApplicationException">
<sequence>
  <element name="description" nillable="true" type="xsd:string" /> 
  <element name="type" type="xsd:int" /> 
</sequence>
</extension>
</complexContent>
</complexType>

<complexType name="OrderFailedException">
<complexContent>
<extension base="ex1:ApplicationException">
<sequence>
  <element name="localMessage" nillable="true" type="xsd:string" /> 
</sequence>
</extension>
</complexContent>
</complexType>

The deploy.wsdd auto generated relevent entries are as follows:-

      <operation name="barMsisdnLevel" qname="operNS:barMsisdnLevel" 
xmlns:operNS="urn:ESelfcareSoap" >
        <parameter name="arg0" type="tns:string" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
        <parameter name="arg1" type="tns:ArrayOfBarringStatusS" 
xmlns:tns="http://soap.valueobject.common.eselfcare.ecrm.ca.viaginterkom.de"/>
        <parameter name="arg2" type="tns:BarringExtendedOperationS" 
xmlns:tns="http://soap.valueobject.common.eselfcare.ecrm.ca.viaginterkom.de"/>
        <parameter name="arg3" type="tns:string" 
xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
        <fault name="OrderFailedException" qname="fns:fault" 
xmlns:fns="urn:ESelfcareSoap" 
class="de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException" 
type="tns:OrderFailedException" 
xmlns:tns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de"/>
        <fault name="AccessDeniedException" qname="fns:fault" 
xmlns:fns="urn:ESelfcareSoap" 
class="de.viaginterkom.ca.ecrm.eselfcare.common.exception.AccessDeniedException"
 type="tns:AccessDeniedException" 
xmlns:tns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de"/>
        <fault name="UnknownIDException" qname="fns:fault" 
xmlns:fns="urn:ESelfcareSoap" 
class="de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDException" 
type="tns:UnknownIDException" 
xmlns:tns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de"/>
      </operation>

The typeMappings for the Exceptions are as follows :-

      <typeMapping
        xmlns:ns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de";
        qname="ns:ApplicationException"
        
type="java:de.viaginterkom.ca.ecrm.eselfcare.common.exception.ApplicationExcepti
on"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
      />

      <typeMapping
        xmlns:ns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de";
        qname="ns:OrderFailedException"
        
type="java:de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedExcepti
on"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
      />

      <typeMapping
        xmlns:ns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de";
        qname="ns:UnknownIDException"
        
type="java:de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDException
"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
      />


An extra point. When considering my problem. Although WSDL2java creates all of 
my serializable data types and exception I do not use them. I use the original 
data types and exceptions defined by the team who maintain the EJB servicee 
which is also acces via RMI from else where in the organisation. A jar file 
containing these types is deployed along with my service jar that has no types 
created by WSDL2java included. 

Clients are free to use either the generated types and exception created from 
the WSDL or utilise the original types jar file.

We have Axis, Glue and SOAP:Lite clients using this web service and I only have 
problems with the Axis clients.

Regards

Steve


---------------------------------------------------
This message was sent using Spansurf Web Mail
Internet access in Spain - http://www.spansurf.com/

Reply via email to