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 MailList Ryan <ma...@gmail.com> on 2008/04/17 08:55:12 UTC
Is it a bug ? I defined a String array parameter in the WSDL file, but after generate server side code use wsdl2java, the parameter changed to String.
My software environment is JDK1.5, tomcat5.5 axis1.4 final.
I wrote a WSDL file by hand, and define a complexType "MsgSendReq". In the
complex type, I defined a string array parameter which name is "ML". After
that, i use WSDL2java command to generate the server side Java code. All
goes well till this step. But after i compile and deploy the code to tomcat
server, the parameter "ML" in the WSDL file for this service show as a
string not a array of string. I tried many times and find it seems that, if
the element of a array is a simple type like string or int, the axis 1.4
treat them as a String or int rather than a array of String or a array of
int, regardless you had already defined it as array.
Following is the code of "MsgSendReq " type define. I had already define ML
as a array of String in both wsdl file and java code , but it shows as a
String parameter after deploy to server.
It is really strange, has any one even know problems like this ? Is is a
bug? Any idea will be highly appreciate!
Ryan.
1.The "MsgSendReq" type defined in the WSDL file wrote by hand.
<xs:complexType name="MsgSendReq">
<xs:sequence>
<xs:element name="MsgType" type="xs:string"/>
<xs:element name="Version" type="xs:string"/>
<xs:element name="AuthInfo" type="ns1:AuthInfo"/>
<xs:element name="SmsType" type="xs:int"/>
<xs:element name="Content" type="xs:string"/>
<xs:element name="SendURL" type="xs:string"/>
<xs:element name="ScheduleDate" type="xs:string"/>
<xs:element name="ML" type="ns1:ArrayOfMobileList"/>
<xs:element name="CreateDate" type="xs:string"/>
<xs:element name="WordLength" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfMobileList">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence/>
<xs:attribute ref="soapenc:arrayType" n1:arrayType="xs:string[]"
xmlns:n1="http://schemas.xmlsoap.org/wsdl/"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
2. The java code "MsgSendReq" generated by WSDL2Java
public class MsgSendReq implements java.io.Serializable {
private java.lang.String msgType;
private java.lang.String version;
private ototype.AuthInfo authInfo;
private int smsType;
private java.lang.String content;
private java.lang.String sendURL;
private java.lang.String scheduleDate;
private java.lang.String[] ML;
private java.lang.String createDate;
3. The define of "MsgSendReq" in the server-config.wsdd file of tomcat
<typeMapping
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
qname="ns32:MsgSendReq"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
type="java:ototype.MsgSendReq" xmlns:ns32="urn:ototype"/>
4.The wsdl file after deployed to tomcat
<complexType name="MsgSendReq">
<sequence>
<element name="MsgType" nillable="true" type="xsd:string"/>
<element name="Version" nillable="true" type="xsd:string"/>
<element name="AuthInfo" nillable="true" type="tns1:AuthInfo"/>
<element name="SmsType" type="xsd:int"/>
<element name="Content" nillable="true" type="xsd:string"/>
<element name="SendURL" nillable="true" type="xsd:string"/>
<element name="ScheduleDate" nillable="true" type="xsd:string"/>
<element name="ML" niable ="true" type="xsd:string"/>
<element name="CreateDate" nillable="true" type="xsd:string"/>
<element name="WordLength" type="xsd:int"/>
<element name="Prioprity" type="xsd:int"/>
</sequence>
</complexType>