You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ax...@ws.apache.org on 2004/09/29 12:03:34 UTC

[jira] Commented: (AXIS-1576) Exceptions with array aren't deserialized

The following comment has been added to this issue:

     Author: Julien Wajsberg
    Created: Wed, 29 Sep 2004 3:03 AM
       Body:
I forgot to attach the received SOAP message :

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<env:Envelope
  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <env:Body>
    <env:Fault>
      <faultcode>env:Server</faultcode>
      <faultstring>Service specific exception: com.ft.ws.test.exception.ComplexException</faultstring>
      <detail>
        <n1:ComplexException
          xmlns:n1="java:test.exception"
          xsi:type="n1:ComplexException">
          <stringArrayData soapenc:arrayType="xsd:string[3]">
            <string xsi:type="xsd:string">data i=0</string>
            <string xsi:type="xsd:string">data i=1</string>
            <string xsi:type="xsd:string">data i=2</string>
          </stringArrayData>
        </n1:ComplexException>
      </detail>
    </env:Fault>
  </env:Body>
</env:Envelope>

---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1576?page=comments#action_53491

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1576

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1576
    Summary: Exceptions with array aren't deserialized
       Type: Bug

     Status: Unassigned
   Priority: Minor

    Project: Axis
 Components: 
             Serialization/Deserialization
   Versions:
             1.2 Beta

   Assignee: 
   Reporter: Julien Wajsberg

    Created: Tue, 28 Sep 2004 9:53 AM
    Updated: Wed, 29 Sep 2004 3:03 AM
Environment: Client: Axis 1.2 beta 3
Server: Weblogic 8.1 SP3

Description:
When an exception is containing an array, it doesn't get correctly deserialized, and therefore it's not caught.

The testcase follows.


Web service :

package test;
import test.exception.ComplexException;

public class BusinessExceptionImpl {
    public void echoComplexException() throws ComplexException {
        ComplexException ex = new ComplexException();
        String[] datas = new String[3];
        for (int i = 0; i < datas.length; i++) {
            datas[i] = "data i=" + i;
        }
        ex.setStringArrayData(datas);
        throw ex;
    }
}


ComplexException.java :

package test.exception;

public class ComplexException extends SimpleException {
    private String[] stringArrayData;

    public String[] getStringArrayData() {
        return stringArrayData;
    }

    public void setStringArrayData(String[] strings) {
        stringArrayData = strings;
    }
}


WSDL (without namespaces and useless things):

<?xml version="1.0" encoding="UTF-8"?>
<definitions>
 <types>
  <xsd:schema>
   <xsd:complexType     name="ArrayOfString">
    <xsd:sequence>
     <xsd:element       type="xsd:string"
       name="string"
       minOccurs="0"
       maxOccurs="unbounded"
       nillable="true">
     </xsd:element>
    </xsd:sequence>
   </xsd:complexType>

   <xsd:element     type="stns:ComplexException"
     name="ComplexException">
   </xsd:element>
   <xsd:complexType     name="ComplexException">
    <xsd:sequence>
     <xsd:element
       type="tp:ArrayOfString"
       name="stringArrayData"
       minOccurs="1"
       maxOccurs="1"
       nillable="true">
     </xsd:element>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:element     name="echoComplexException">
    <xsd:complexType>
    </xsd:complexType>
   </xsd:element>
   <xsd:element     name="echoComplexExceptionResponse">
    <xsd:complexType>
    </xsd:complexType>
   </xsd:element>
  </xsd:schema>
 </types>

 <message   name="echoComplexException">
  <part    xmlns:partns="http://test.ws.ft.com"
    name="parameters"
    element="partns:echoComplexException">
  </part>
 </message>

 <message   name="echoComplexExceptionResponse">
  <part    xmlns:partns="http://test.ws.ft.com"
    name="parameters"
    element="partns:echoComplexExceptionResponse">
  </part>
 </message>

 <message   name="ComplexException">
  <part    xmlns:partns="java:com.ft.ws.test.exception"
    name="ComplexException"
    element="partns:ComplexException">
  </part>
 </message>

 <portType   name="BusinessExceptionPort">
  <operation    name="echoComplexException">
   <input     message="tns:echoComplexException">
   </input>
   <output     message="tns:echoComplexExceptionResponse">
   </output>
   <fault     name="ComplexException"
     message="tns:ComplexException">
   </fault>
  </operation>
 </portType>

 <binding   type="tns:BusinessExceptionPort"
   name="BusinessExceptionPort">
  <soap:binding    style="document"
    transport="http://schemas.xmlsoap.org/soap/http">
  </soap:binding>
  <operation    name="echoComplexException">
   <soap:operation     style="document"
     soapAction="">
   </soap:operation>
   <input>
    <soap:body      namespace="http://test"
      use="literal">
    </soap:body>
   </input>
   <output>
    <soap:body      namespace="http://test"
      use="literal">
    </soap:body>
   </output>
   <fault     name="ComplexException">
    <soap:fault      namespace="http://test"
      name="ComplexException"
      use="literal">
    </soap:fault>
   </fault>
  </operation>
 </binding>
</definitions>


Axis client :
   private BusinessExceptionPort getClient() {
        BusinessException service = new BusinessExceptionLocator();
        try {
            return service.getBusinessExceptionPort();
        } catch (ServiceException e) {
            e.printStackTrace();
            fail("error");
            return null;
        }
    }

    public void testEchoComplexException() {
        try {
            getClient().echoComplexException();
            fail("expected exception");
        } catch (ComplexException e) {
        } catch (Throwable e) {
            e.printStackTrace();
            fail("unexpected exception : " + e.getMessage());
        }
    }


And we get :
28 sept. 2004 18:43:18 org.apache.axis.encoding.ser.BeanPropertyTarget set
GRAVE: Could not convert [Ljava.lang.String; to bean field 'stringArrayData', type test.vo.holders.ArrayOfString
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.IllegalArgumentException: argument type mismatch
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentException: argument type mismatch



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira