axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liangfei.Su" <suliang...@gmail.com>
Subject Question: AXIS1.4 Client handle primitive array get illegal argument exception
Date Sat, 08 Oct 2011 15:45:55 GMT
Hi, All

I encounter a problem that AXIS report error "IllegalArgumentException" when
the web service server return some boolean array. The original post is here:
http://forums.citrix.com/thread.jspa?messageID=1586924&#1586924<http://forums.citrix.com/thread.jspa?messageID=1586924%EF%BF%BD>

The environment is AXIS 1.4.

I had a wsdl defined "csvserver" as blow:
<xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="csvserver">
        <xsd:sequence>
          <xsd:element name="name" type="xsd:string"/>
          <xsd:element name="insertvserveripport" type="xsd:string"/>
          <xsd:element name="vipheader" type="xsd:string"/>
          <xsd:element name="ipaddress" type="xsd:string"/>
          <xsd:element name="ipaddress2" type="xsd:string"/>
          <xsd:element name="ippattern" type="xsd:string"/>
          <xsd:element name="ipmask" type="xsd:string"/>
          <xsd:element name="value" type="xsd:string"/>
          <xsd:element name="port" type="xsd:unsignedInt"/>
          <xsd:element name="range" type="xsd:unsignedInt"/>
          <xsd:element name="servicetype" type="xsd:string"/>
          <xsd:element name="type" type="xsd:string"/>
          <xsd:element name="state" type="xsd:string"/>
          <xsd:element name="stateupdate" type="xsd:string"/>
          <xsd:element name="status" type="xsd:int"/>
          <xsd:element name="cachetype" type="xsd:string"/>
          <xsd:element name="redirect" type="xsd:string"/>
          <xsd:element name="precedence" type="xsd:string"/>
          <xsd:element name="redirecturl" type="xsd:string"/>
          <xsd:element name="authentication" type="xsd:string"/>
          <xsd:element name="authn401" type="xsd:string"/>
          <xsd:element name="authnvsname" type="xsd:string"/>
          <xsd:element name="casesensitive" type="xsd:string"/>
          <xsd:element name="homepage" type="xsd:string"/>
          <xsd:element name="dnsvservername" type="xsd:string"/>
          <xsd:element name="domain" type="xsd:string"/>
          <xsd:element name="rule" type="ns:stringList"/>
          <xsd:element name="policyname" type="ns:stringList"/>
          <xsd:element name="hits" type="ns:unsignedIntList"/>
          <xsd:element name="servicename" type="xsd:string"/>
          <xsd:element name="weight" type="xsd:unsignedInt"/>
          <xsd:element name="cachevserver" type="xsd:string"/>
          <xsd:element name="backupvserver" type="xsd:string"/>
          <xsd:element name="priority" type="ns:unsignedIntList"/>
          <xsd:element name="clttimeout" type="xsd:unsignedInt"/>
          <xsd:element name="listenpolicy" type="xsd:string"/>
          <xsd:element name="listenpriority" type="xsd:unsignedInt"/>
          <xsd:element name="somethod" type="xsd:string"/>
          <xsd:element name="sopersistence" type="xsd:string"/>
          <xsd:element name="sopersistencetimeout" type="xsd:unsignedInt"/>
          <xsd:element name="sothreshold" type="xsd:unsignedInt"/>
          <xsd:element name="cacheable" type="xsd:string"/>
          <xsd:element name="url" type="xsd:string"/>
          <xsd:element name="gotopriorityexpression" type="xsd:string"/>
          <xsd:element name="redirectportrewrite" type="xsd:string"/>
          <xsd:element name="downstateflush" type="xsd:string"/>
          <xsd:element name="disableprimaryondown" type="xsd:string"/>
          <xsd:element name="type2" type="xsd:string"/>
          *<xsd:element name="invoke" type="ns:booleanList"/>*
          <xsd:element name="labeltype" type="ns:stringList"/>
          <xsd:element name="labelname" type="ns:stringList"/>
          <xsd:element name="gt2gb" type="xsd:string"/>
          <xsd:element name="statechangetimesec" type="xsd:string"/>
          <xsd:element name="statechangetimemsec" type="xsd:unsignedInt"/>
          <xsd:element name="tickssincelaststatechange"
type="xsd:unsignedInt"/>
          <xsd:element name="rtspnat" type="xsd:string"/>
          <xsd:element name="authenticationhost" type="xsd:string"/>
          <xsd:element name="push" type="xsd:string"/>
          <xsd:element name="pushvserver" type="xsd:string"/>
          <xsd:element name="pushlabel" type="xsd:string"/>
          <xsd:element name="pushmulticlients" type="xsd:string"/>
          <xsd:element name="tcpprofilename" type="xsd:string"/>
          <xsd:element name="httpprofilename" type="xsd:string"/>
          <xsd:element name="comment" type="xsd:string"/>
          <xsd:element name="scflag" type="ns:stringList"/>
          <xsd:element name="authorpolicyname" type="ns:stringList"/>
          <xsd:element name="authorpolicypriority"
type="ns:unsignedIntList"/>
          <xsd:element name="authorpolicyscflag" type="ns:stringList"/>
          <xsd:element name="authorpolicygotoprioexpr"
type="ns:stringList"/>
          <xsd:element name="authorpolicybindpoint" type="ns:stringList"/>
          <xsd:element name="authorinvoke" type="ns:booleanList"/>
          <xsd:element name="authorpolicyinvokelabeltype"
type="ns:stringList"/>
          <xsd:element name="authorpolicyinvokelabelname"
type="ns:stringList"/>
          <xsd:element name="rwpolicyname" type="ns:stringList"/>
          <xsd:element name="rwpolicypriority" type="ns:unsignedIntList"/>
          <xsd:element name="rwpolicygotoprioexpression"
type="ns:stringList"/>
          <xsd:element name="rwpolicybindpoint" type="ns:stringList"/>
          <xsd:element name="rwinvoke" type="ns:booleanList"/>
          <xsd:element name="rwpolicyinvokelabeltype" type="ns:stringList"/>
          <xsd:element name="rwpolicyinvokelabelname" type="ns:stringList"/>
          <xsd:element name="cachepolicyname" type="ns:stringList"/>
          <xsd:element name="cachepolicypriority"
type="ns:unsignedIntList"/>
          <xsd:element name="cachepolicygotoprioexpression"
type="ns:stringList"/>
          <xsd:element name="cachepolicybindpoint" type="ns:stringList"/>
          <xsd:element name="cacheinvoke" type="ns:booleanList"/>
          <xsd:element name="cachepolicyinvokelabeltype"
type="ns:stringList"/>
          <xsd:element name="cachepolicyinvokelabelname"
type="ns:stringList"/>
          <xsd:element name="rsppolicyname" type="ns:stringList"/>
          <xsd:element name="rsppolicypriority" type="ns:unsignedIntList"/>
          <xsd:element name="rsppolicygotoprioexpression"
type="ns:stringList"/>
          <xsd:element name="rspinvoke" type="ns:booleanList"/>
          <xsd:element name="rsppolicyinvokelabeltype"
type="ns:stringList"/>
          <xsd:element name="rsppolicyinvokelabelname"
type="ns:stringList"/>
          <xsd:element name="tmtrafficpolicyname" type="ns:stringList"/>
          <xsd:element name="tmtrafficpolicypriority"
type="ns:unsignedIntList"/>
          <xsd:element name="cmppolicyname" type="ns:stringList"/>
          <xsd:element name="cmppolicypriority" type="ns:unsignedIntList"/>
          <xsd:element name="cmppolicyscflag" type="ns:stringList"/>
          <xsd:element name="cmppolicygotoprioexpr" type="ns:stringList"/>
          <xsd:element name="cmppolicybindpoint" type="ns:stringList"/>
          <xsd:element name="cmpinvoke" type="ns:booleanList"/>
          <xsd:element name="cmppolicyinvokelabeltype"
type="ns:stringList"/>
          <xsd:element name="cmppolicyinvokelabelname"
type="ns:stringList"/>
          <xsd:element name="cswtargetserver" type="ns:stringList"/>
          <xsd:element name="cswpolicygotoprioexpr" type="ns:stringList"/>
          <xsd:element name="cswpolicybindpoint" type="ns:stringList"/>
          <xsd:element name="cswinvoke" type="ns:booleanList"/>
          <xsd:element name="cswpolicyinvokelabeltype"
type="ns:stringList"/>
          <xsd:element name="cswpolicyinvokelabelname"
type="ns:stringList"/>
        </xsd:sequence>
      </xsd:complexType>

The ns:xxxList is defined as a list of the object, like following:
        <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="booleanList">
        <xsd:complexContent>
          <xsd:restriction base="soapenc:Array">
            <xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:boolean[]"/>
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>

With this wsdl definition, i get an server returned XML that contains data
as:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:NSConfig">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/">
      <ns:getcsvserverResponse>
         <return xsi:type="ns:getcsvserverResult">
            <rc xsi:type="xsd:unsignedInt">0</rc>
            <message xsi:type="xsd:string">Done</message>
            <List xsi:type="SOAP-ENC:Array" SOAP-ENC:offset="[0]"
SOAP-ENC:arrayType="ns:csvserver[1]">
               <item xsi:type="ns:csvserver">
                  <name xsi:type="xsd:string">cs1</name>
                  <insertvserveripport
xsi:type="xsd:string">OFF</insertvserveripport>
                  <ipaddress xsi:type="xsd:string">0.0.0.0</ipaddress>
                  <ipaddress2
xsi:type="xsd:string">192.168.1.100</ipaddress2>
                  <ippattern xsi:type="xsd:string">0.0.0.0</ippattern>
                  <ipmask xsi:type="xsd:string">255.255.255.255</ipmask>
                  <port xsi:type="xsd:unsignedInt">80</port>
                  <range xsi:type="xsd:unsignedInt">1</range>
                  <servicetype xsi:type="xsd:string">HTTP</servicetype>
                  <type xsi:type="xsd:string">CONTENT</type>
                  <state xsi:type="xsd:string">UP</state>
                  <stateupdate xsi:type="xsd:string">DISABLED</stateupdate>
                  <status xsi:type="xsd:int">1</status>
                  <precedence xsi:type="xsd:string">RULE</precedence>
                  <authentication xsi:type="xsd:string">OFF</authentication>
                  <authn401 xsi:type="xsd:string">OFF</authn401>
                  <casesensitive xsi:type="xsd:string">ON</casesensitive>
                  <rule xsi:type="xsd:string"/>
                  <policyname xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string">""</item>
                     <item xsi:type="xsd:string">policy1</item>
                  </policyname>
                  <hits xsi:type="SOAP-ENC:Array" SOAP-ENC:offset="[0]"
SOAP-ENC:arrayType="xsd:unsignedInt[2]">
                     <item xsi:type="xsd:unsignedInt">0</item>
                     <item xsi:type="xsd:unsignedInt">0</item>
                  </hits>
                  <weight xsi:type="xsd:unsignedInt">0</weight>
                  <cachevserver xsi:type="xsd:string">vs2</cachevserver>
                  <priority xsi:type="SOAP-ENC:Array" SOAP-ENC:offset="[0]"
SOAP-ENC:arrayType="xsd:unsignedInt[2]">
                     <item xsi:type="xsd:unsignedInt">0</item>
                     <item xsi:type="xsd:unsignedInt">0</item>
                  </priority>
                  <clttimeout xsi:type="xsd:unsignedInt">180</clttimeout>
                  <somethod xsi:type="xsd:string">NONE</somethod>
                  <sopersistence
xsi:type="xsd:string">DISABLED</sopersistence>
                  <sopersistencetimeout
xsi:type="xsd:unsignedInt">2</sopersistencetimeout>
                  <sothreshold xsi:type="xsd:unsignedInt">0</sothreshold>
                  <cacheable xsi:type="xsd:string">NO</cacheable>
                  <redirectportrewrite
xsi:type="xsd:string">DISABLED</redirectportrewrite>
                  <downstateflush
xsi:type="xsd:string">ENABLED</downstateflush>
                  <disableprimaryondown
xsi:type="xsd:string">DISABLED</disableprimaryondown>
                  *<invoke xsi:type="xsd:boolean">false</invoke>*
                  <labeltype xsi:type="xsd:string"/>
                  <labelname xsi:type="xsd:string"/>
                  <gt2gb xsi:type="xsd:string">DISABLED</gt2gb>
                  <statechangetimesec xsi:type="xsd:string">Thu Sep 29
08:56:54 2011</statechangetimesec>
                  <statechangetimemsec
xsi:type="xsd:unsignedInt">245</statechangetimemsec>
                  <tickssincelaststatechange
xsi:type="xsd:unsignedInt">77748209</tickssincelaststatechange>
                  <rtspnat xsi:type="xsd:string">OFF</rtspnat>
                  <push xsi:type="xsd:string">DISABLED</push>
                  <pushlabel xsi:type="xsd:string">none</pushlabel>
                  <pushmulticlients
xsi:type="xsd:string">NO</pushmulticlients>
                  <cswtargetserver xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string">vs2</item>
                     <item xsi:type="xsd:string">vs1</item>
                  </cswtargetserver>
                  <cswpolicygotoprioexpr xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string"/>
                     <item xsi:type="xsd:string"/>
                  </cswpolicygotoprioexpr>
                  <cswpolicybindpoint xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string"/>
                     <item xsi:type="xsd:string"/>
                  </cswpolicybindpoint>
                  <cswinvoke xsi:type="SOAP-ENC:Array" SOAP-ENC:offset="[0]"
SOAP-ENC:arrayType="xsd:boolean[2]">
                     <item xsi:type="xsd:boolean">false</item>
                     <item xsi:type="xsd:boolean">false</item>
                  </cswinvoke>
                  <cswpolicyinvokelabeltype xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string"/>
                     <item xsi:type="xsd:string"/>
                  </cswpolicyinvokelabeltype>
                  <cswpolicyinvokelabelname xsi:type="SOAP-ENC:Array"
SOAP-ENC:offset="[0]" SOAP-ENC:arrayType="xsd:string[2]">
                     <item xsi:type="xsd:string"/>
                     <item xsi:type="xsd:string"/>
                  </cswpolicyinvokelabelname>
               </item>
            </List>
         </return>
      </ns:getcsvserverResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

At the place of the bold <invoke> element, AXIS client throw exception when
it try to deserialize the ns:csvserver item. So i get the exception:
The java exception comes from AXIS deserialzer.
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget
.java:157)
at org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerIm
pl.java:249)
at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.
java:509)
at org.apache.axis.encoding.DeserializationContext.endElement(Deserializa
tionContext.java:1087)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.jav
a:171)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement
.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
... 34 more


My though is that AXIS reports the error when if found the return <invoke>
element is not like a ns:booleanlist, but xsd:boolean. But is there any way
to help work around this issue to let AXIS *reccognize* that here the
returned <invoke> element(s) actually are the items of the boolean list that
defined in WSDL? Register an deserializer is the only way for this case of
server behavior (server side can not be changed in my case) ?

Thanks
Ralph.

Mime
View raw message