[ http://jira.codehaus.org/browse/XFIRE-826?page=all ]

Dan Diephouse updated XFIRE-826:
--------------------------------

    Fix Version/s: 1.2.5

Thanks! Scheduling for 1.2.5 (1.2.4 was cut over the weekend and will be 
announced today).

> Problem writing byte array of size zero
> ---------------------------------------
>
>                 Key: XFIRE-826
>                 URL: http://jira.codehaus.org/browse/XFIRE-826
>             Project: XFire
>          Issue Type: Bug
>    Affects Versions: 1.2.3
>            Reporter: Frank Hemer
>         Assigned To: Dan Diephouse
>             Fix For: 1.2.5
>
>
> xfire1.2.3, aegis binding.
> The following code causes trouble if one of the byte arrays is of size zero 
> in 
> the Container class. As a result, either a Fault or an invalid number of 
> Containers is received on the other side.
> The server I tested this simply echos the result ...
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> import org.codehaus.xfire.service.binding.ObjectServiceFactory;
> import org.codehaus.xfire.service.Service;
> import org.codehaus.xfire.client.XFireProxyFactory;
> import org.codehaus.xfire.transport.Channel;
> public class Test {
>    public static void main (String [] args) {
>       try {
>          Class serviceCallback = Callback.class;
>          ObjectServiceFactory serviceFactory = new ObjectServiceFactory ();
>          Service serviceModel = serviceFactory.create (serviceCallback);
>          XFireProxyFactory proxyFactory = new XFireProxyFactory ();
>          Callback testCallback = (Callback) proxyFactory.create(serviceModel, 
> "localhost:8080/" + serviceCallback.getName ());
>          Container [] containers = new Container [2];
>          System.out.println ("C DSPExternalTest::containerTest");
>          containers [0] = new Container ();
>          containers [0].myField = 3;
>          containers [0].myArray = new byte [0];//causes trouble
>          containers [1] = new Container ();
>          containers [1].myField = 4;
>          containers [1].myArray = new byte [2];
>          containers = testCallback.containerTest (containers);
>          System.out.println ("Containers: "+containers.length);
>          System.out.println ("Containers1: "+containers [0].myField);
>          System.out.println ("Containers2: "+containers [1].myField);
>          System.out.println ("Containers1: "+containers [0].myArray.length);
>          System.out.println ("Containers2: "+containers [1].myArray.length);
>       } catch (Exception e) {
>          e.printStackTrace ();
>       }
>    }
> }
> public class Container implements java.io.Serializable {
>    public Container () {
>    }
>    public int myField;
>    public byte [] myArray;
>    public int getMyField () {
>       return myField;
>    }
>    public void setMyField (int field) {
>       myField = field;
>    }
>    public byte [] getMyArray () {
>       return myArray;
>    }
>    public void setMyArray (byte [] array) {
>       myArray = array;
>    }
> }
> public interface Callback {
>    Container [] containerTest (Container [] containers) throws Exception;
> }
> public class CallbackImpl implements Callback {
>    public Container [] containerTest (Container [] containers) throws 
> Exception {
>       System.out.println ("S CallbackImpl::containerTest");
>       System.out.println ("Containers: "+containers.length);
>       System.out.println ("Containers1: "+containers [0].myField);
>       System.out.println ("Containers2: "+containers [1].myField);
>       System.out.println ("Containers1: "+containers [0].myArray.length);
>       System.out.println ("Containers2: "+containers [1].myArray.length);
>       return containers;
>    }
> }
> And here's the wsdl:
> −
>       <wsdl:definitions targetNamespace="http://DefaultNamespace";>
> &#8722;
>       <wsdl:types>
> &#8722;
>       <xsd:schema attributeFormDefault="qualified" 
> elementFormDefault="qualified" targetNamespace="http://DefaultNamespace";>
> &#8722;
>       <xsd:complexType name="ArrayOfContainer">
> &#8722;
>       <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="Container" 
> nillable="true" type="tns:Container"/>
> </xsd:sequence>
> </xsd:complexType>
> &#8722;
>       <xsd:complexType name="Container">
> &#8722;
>       <xsd:sequence>
> <xsd:element minOccurs="0" name="myArray" nillable="true" 
> type="xsd:base64Binary"/>
> <xsd:element minOccurs="0" name="myField" type="xsd:int"/>
> </xsd:sequence>
> </xsd:complexType>
> &#8722;
>       <xsd:element name="containerTest">
> &#8722;
>       <xsd:complexType>
> &#8722;
>       <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" 
> type="tns:ArrayOfContainer"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> &#8722;
>       <xsd:element name="containerTestResponse">
> &#8722;
>       <xsd:complexType>
> &#8722;
>       <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" 
> type="tns:ArrayOfContainer"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> </wsdl:types>
> &#8722;
>       <wsdl:message name="containerTestRequest">
> <wsdl:part name="parameters" element="tns:containerTest"/>
> </wsdl:message>
> &#8722;
>       <wsdl:message name="containerTestResponse">
> <wsdl:part name="parameters" element="tns:containerTestResponse"/>
> </wsdl:message>
> &#8722;
>       <wsdl:portType name="CallbackPortType">
> &#8722;
>       <wsdl:operation name="containerTest">
> <wsdl:input name="containerTestRequest" message="tns:containerTestRequest"/>
> <wsdl:output name="containerTestResponse" 
> message="tns:containerTestResponse"/>
> </wsdl:operation>
> </wsdl:portType>
> &#8722;
>       <wsdl:binding name="CallbackHttpBinding" type="tns:CallbackPortType">
> <wsdlsoap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
> &#8722;
>       <wsdl:operation name="containerTest">
> <wsdlsoap:operation soapAction=""/>
> &#8722;
>       <wsdl:input name="containerTestRequest">
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> &#8722;
>       <wsdl:output name="containerTestResponse">
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> &#8722;
>       <wsdl:service name="Callback">
> &#8722;
>       <wsdl:port name="CallbackHttpPort" binding="tns:CallbackHttpBinding">
> <wsdlsoap:address location="http://localhost/services/Callback"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to