You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tony Liu <li...@gmail.com> on 2008/04/08 04:13:42 UTC

Primative values are not returned while anyType is specified.

/*********** source code ********************/
package ws.example;


public
class TemperatureConverter {



public TempObject[] calString(String a) {

TempObject[] objs =
new TempObject[2];

objs[0] =
new TempObject();

objs[0].setA(1);

objs[0].setValue(
new Integer(10));


objs[1] =
new TempObject();

objs[1].setA(2);

objs[1].setValue(
new Integer(20));


return objs;

}

}


package
ws.example;


public
class TempObject {

private int a;

private Object value;


public TempObject() {

a = 1;


}


public int getA() {

return a;

}


public void setA(int v) {

this.a = v;

}


public Object getValue() {

return value;

}


public void setValue(Object v) {

this.value = v;

}

}
/******************************************/

/**************wsdl file*******************/
<?
xml version="1.0" encoding="UTF-8"?>

<
wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="
http://example.ws/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="
http://example.ws" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="
http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://example.ws">


<wsdl:documentation>Temperature</wsdl:documentation>

<wsdl:types>

<xs:schema xmlns:ns="http://example.ws" attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://example.ws">

<xs:element name="calString">

<xs:complexType>

<xs:sequence>

<xs:element minOccurs="0" name="a" nillable="true" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="calStringResponse">

<xs:complexType>

<xs:sequence>

<xs:element maxOccurs="unbounded" minOccurs="0" name="return"
nillable="true" type="ns1:TempObject"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

<xs:schema xmlns:ax24="http://example.ws/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://example.ws/xsd">

<xs:complexType name="TempObject">

<xs:sequence>

<xs:element minOccurs="0" name="a" type="xs:int"/>

<xs:element minOccurs="0" name="value" nillable="true" type="xs:anyType"/>

</xs:sequence>

</xs:complexType>

</xs:schema>

</wsdl:types>

<wsdl:message name="calStringRequest">

<wsdl:part name="parameters" element="ns0:calString"/>

</wsdl:message>

<wsdl:message name="calStringResponse">

<wsdl:part name="parameters" element="ns0:calStringResponse"/>

</wsdl:message>

<wsdl:portType name="TemperaturePortType">

<wsdl:operation name="calString">

<wsdl:input message="ns0:calStringRequest" wsaw:Action="urn:calString"/>

<wsdl:output message="ns0:calStringResponse"
wsaw:Action="urn:calStringResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="TemperatureSOAP11Binding"
type="ns0:TemperaturePortType">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>

<wsdl:operation name="calString">

<soap:operation soapAction="urn:calString" style="document"/>

<wsdl:input>

<soap:body use="literal"/>

</wsdl:input>

<wsdl:output>

<soap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="Temperature">

<wsdl:port name="TemperatureSOAP11port_http"
binding="ns0:TemperatureSOAP11Binding">

<soap:address location="http://maximus:8080/axis2/services/Temperature"/>

</wsdl:port>


</wsdl:service>

</wsdl:definitions>
/******************************************/

/*************outgoing soap****************/
<?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:q0="http://example.ws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<q0:calString />
</soapenv:Body>
</soapenv:Envelope>
/******************************************/

/*************incoming soap****************/
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:calStringResponse xmlns:ns="http://example.ws" xmlns:ax24="
http://example.ws/xsd">
<ns:return type="ws.example.TempObject">
<ax24:a>1</ax24:a>
<ax24:value type="java.lang.Integer" />
</ns:return>
<ns:return type="ws.example.TempObject">
<ax24:a>2</ax24:a>
<ax24:value type="java.lang.Integer" />
</ns:return>
</ns:calStringResponse>
</soapenv:Body>
</soapenv:Envelope>
/******************************************/

You can see the Integer values of TempObject are not returned in the
incoming soap. I also tried other primitive objects, I got the same problem.
Can anyone please tell me what's wrong? Thanks.

Tony Liu

Re: Primative values are not returned while anyType is specified.

Posted by Tony Liu <li...@gmail.com>.
Well, the problem seems to be fixed in the latest night build.


On 4/8/08, Tony Liu <li...@gmail.com> wrote:
>
> /*********** source code ********************/
> package ws.example;
>
>
> public
> class TemperatureConverter {
>
>
>
> public TempObject[] calString(String a) {
>
> TempObject[] objs =
> new TempObject[2];
>
> objs[0] =
> new TempObject();
>
> objs[0].setA(1);
>
> objs[0].setValue(
> new Integer(10));
>
>
> objs[1] =
> new TempObject();
>
> objs[1].setA(2);
>
> objs[1].setValue(
> new Integer(20));
>
>
> return objs;
>
> }
>
> }
>
>
> package
> ws.example;
>
>
> public
> class TempObject {
>
> private int a;
>
> private Object value;
>
>
> public TempObject() {
>
> a = 1;
>
>
> }
>
>
> public int getA() {
>
> return a;
>
> }
>
>
> public void setA(int v) {
>
> this.a = v;
>
> }
>
>
> public Object getValue() {
>
> return value;
>
> }
>
>
> public void setValue(Object v) {
>
> this.value = v;
>
> }
>
> }
> /******************************************/
>
> /**************wsdl file*******************/
> <?
> xml version="1.0" encoding="UTF-8"?>
>
> <
> wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="
> http://example.ws/xsd" xmlns:wsaw="
> http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="
> http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://example.ws"
> xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="
> http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="
> http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="
> http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="
> http://example.ws">
>
> <wsdl:documentation>Temperature</wsdl:documentation>
>
> <wsdl:types>
>
> <xs:schema xmlns:ns="http://example.ws" attributeFormDefault="qualified"
> elementFormDefault="qualified" targetNamespace="http://example.ws">
>
> <xs:element name="calString">
>
> <xs:complexType>
>
> <xs:sequence>
>
> <xs:element minOccurs="0" name="a" nillable="true" type="xs:string"/>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:element>
>
> <xs:element name="calStringResponse">
>
> <xs:complexType>
>
> <xs:sequence>
>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
> nillable="true" type="ns1:TempObject"/>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:element>
>
> </xs:schema>
>
> <xs:schema xmlns:ax24="http://example.ws/xsd"
> attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://example.ws/xsd">
>
> <xs:complexType name="TempObject">
>
> <xs:sequence>
>
> <xs:element minOccurs="0" name="a" type="xs:int"/>
>
> <xs:element minOccurs="0" name="value" nillable="true" type="xs:anyType"/>
>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:schema>
>
> </wsdl:types>
>
> <wsdl:message name="calStringRequest">
>
> <wsdl:part name="parameters" element="ns0:calString"/>
>
> </wsdl:message>
>
> <wsdl:message name="calStringResponse">
>
> <wsdl:part name="parameters" element="ns0:calStringResponse"/>
>
> </wsdl:message>
>
> <wsdl:portType name="TemperaturePortType">
>
> <wsdl:operation name="calString">
>
> <wsdl:input message="ns0:calStringRequest" wsaw:Action="urn:calString"/>
>
> <wsdl:output message="ns0:calStringResponse"
> wsaw:Action="urn:calStringResponse"/>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="TemperatureSOAP11Binding"
> type="ns0:TemperaturePortType">
>
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
>
> <wsdl:operation name="calString">
>
> <soap:operation soapAction="urn:calString" style="document"/>
>
> <wsdl:input>
>
> <soap:body use="literal"/>
>
> </wsdl:input>
>
> <wsdl:output>
>
> <soap:body use="literal"/>
>
> </wsdl:output>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="Temperature">
>
> <wsdl:port name="TemperatureSOAP11port_http"
> binding="ns0:TemperatureSOAP11Binding">
>
> <soap:address location="http://maximus:8080/axis2/services/Temperature"/>
>
> </wsdl:port>
>
>
> </wsdl:service>
>
> </wsdl:definitions>
> /******************************************/
>
> /*************outgoing soap****************/
> <?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:q0="http://example.ws"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <q0:calString />
> </soapenv:Body>
> </soapenv:Envelope>
> /******************************************/
>
> /*************incoming soap****************/
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> ">
> <soapenv:Body>
> <ns:calStringResponse xmlns:ns="http://example.ws" xmlns:ax24="
> http://example.ws/xsd">
> <ns:return type="ws.example.TempObject">
> <ax24:a>1</ax24:a>
> <ax24:value type="java.lang.Integer" />
> </ns:return>
> <ns:return type="ws.example.TempObject">
> <ax24:a>2</ax24:a>
> <ax24:value type="java.lang.Integer" />
> </ns:return>
> </ns:calStringResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> /******************************************/
>
> You can see the Integer values of TempObject are not returned in the
> incoming soap. I also tried other primitive objects, I got the same problem.
> Can anyone please tell me what's wrong? Thanks.
>
> Tony Liu
>
>
>
>
>