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 Swathi Kanury <SK...@lifecare.com> on 2005/07/18 17:46:38 UTC

Getting NullPointerException with Multi dim arrays

Hi All,

 

       I am trying to write a client using axis for the below wsdl. This
web service is deployed on weblogic. I am getting 

"java.lang.NullPointerException at
java.lang.reflect.Array.getLength(Native Method)" exception.

 

<?xml version="1.0" encoding="UTF-8"?>
<definitions  xmlns:tns="http://localhost"
  xmlns:wsr="http://www.openuri.org/2002/10/soap/reliability/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:soap12enc="http://www.w3.org/2002/12/soap-encoding"
  xmlns:conv="http://www.openuri.org/2002/04/wsdl/conversation/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:s="http://www.w3.org/2001/XMLSchema"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  targetNamespace="http://localhost">
 <types   xmlns:tns="http://localhost"
   xmlns:wsr="http://www.openuri.org/2002/10/soap/reliability/"
   xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
   xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
   xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:soap12enc="http://www.w3.org/2002/12/soap-encoding"
   xmlns:conv="http://www.openuri.org/2002/04/wsdl/conversation/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:s="http://www.w3.org/2001/XMLSchema"
   xmlns="http://schemas.xmlsoap.org/wsdl/">
  <xsd:schema    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:language_builtins.lang"
    elementFormDefault="qualified"
    attributeFormDefault="qualified"
    targetNamespace="java:language_builtins.lang">
   <xsd:import
namespace="http://schemas.xmlsoap.org/soap/encoding/">
   </xsd:import>
   <xsd:complexType     name="ArrayOfArrayOfString">
    <xsd:complexContent>
     <xsd:restriction
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
       base="soapenc:Array">
      <xsd:attribute
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        ref="soapenc:arrayType"
        wsdl:arrayType="xsd:string[,]">
      </xsd:attribute>
     </xsd:restriction>
    </xsd:complexContent>
   </xsd:complexType>
  </xsd:schema>
  <xsd:schema    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:stns="java:language_builtins.util"
    elementFormDefault="qualified"
    attributeFormDefault="qualified"
    targetNamespace="java:language_builtins.util">
   <xsd:import
namespace="http://schemas.xmlsoap.org/soap/encoding/">
   </xsd:import>
   <xsd:complexType     name="Vector">
    <xsd:complexContent>
     <xsd:restriction
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
       base="soapenc:Array">
      <xsd:attribute
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        ref="soapenc:arrayType"
        wsdl:arrayType="xsd:anyType[]">
      </xsd:attribute>
     </xsd:restriction>
    </xsd:complexContent>
   </xsd:complexType>
  </xsd:schema>
 </types>
 <message   name="createWebCase">
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string0">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string1">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:decimal"
    name="bigDecimal">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:decimal"
    name="bigDecimal0">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string2">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string3">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string4">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string5">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:decimal"
    name="bigDecimal1">
  </part>
  <part    xmlns:partns="http://www.w3.org/2001/XMLSchema"
    type="partns:string"
    name="string6">
  </part>
  <part    xmlns:partns="java:language_builtins.lang"
    type="partns:ArrayOfArrayOfString"
    name="strings">
  </part>
 </message>
 <message   name="createWebCaseResponse">
  <part    xmlns:partns="java:language_builtins.util"
    type="partns:Vector"
    name="result">
  </part>
 </message>
 <portType   name="WebCaseWebServicePort">
  <operation    name="createWebCase">
   <input     message="tns:createWebCase">
   </input>
   <output     message="tns:createWebCaseResponse">
   </output>
  </operation>
 </portType>
 <binding   type="tns:WebCaseWebServicePort"
   name="WebCaseWebServicePort">
  <soap:binding    style="rpc"
    transport="http://schemas.xmlsoap.org/soap/http">
  </soap:binding>
  <operation    name="createWebCase">
   <soap:operation     style="rpc"
     soapAction="">
   </soap:operation>
   <input>
    <soap:body      namespace="http://localhost"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      use="encoded">
    </soap:body>
   </input>
   <output>
    <soap:body      namespace="http://localhost"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      use="encoded">
    </soap:body>
   </output>
  </operation>
 </binding>
 <service   name="WebCaseWebService">
  <port    name="WebCaseWebServicePort"
    binding="tns:WebCaseWebServicePort">
   <soap:address
location="http://wpsun02.lcc.corp.pvt:5150/WebCaseWebService/WebCaseWebS
ervice">
   </soap:address>
  </port>
 </service>
</definitions>

 

 

Here is what I think the problem is:

The soap request generated by axis for the ArrayOfArrayOfStrings is as
below

   <strings xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[][2]"
xmlns:ns2="java:language_builtins.lang"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/

encoding/">

    <item soapenc:arrayType="xsd:string[3]">

     <item>EDMAT</item>

     <item>43</item>

     <item>1488</item>

    </item>

    <item soapenc:arrayType="xsd:string[3]">

     <item>KIT</item>

     <item>43</item>

     <item>1488</item>

    </item>

   </strings>

 

But I think weblogic is expecting the request in below format:

<strings  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"

  soapenc:arrayType="xsd:string[2,3]">

 <string   xsi:type="xsd:string"> EDMAT </string>

<string   xsi:type="xsd:string"> 43 </string>

<string   xsi:type="xsd:string"> 1488 </string>

<string   xsi:type="xsd:string"> KIT </string>

<string   xsi:type="xsd:string"> 43 </string>

<string   xsi:type="xsd:string"> 1488 </string>

</strings>

 

Is there any way that I can tell axis to generate the response xml in
the format that is understandable by weblogic.

 

Thanks in advance for your help.

 

-Kanury.

 

The information contained in this e-mail may be confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.

Re: Getting NullPointerException with Multi dim arrays

Posted by Anne Thomas Manes <at...@gmail.com>.
This definition is not valid for an attribute:

      <xsd:attribute        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        ref="soapenc:arrayType"
        wsdl:arrayType="xsd:string[,]">
      </xsd:attribute>

Attributes cannot contain arrays or structures.

Anne

On 7/18/05, Swathi Kanury <SK...@lifecare.com> wrote:
>       <xsd:attribute       
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>         ref="soapenc:arrayType"
>         wsdl:arrayType="xsd:string[,]">
>       </xsd:attribute>
>