Shelli,

Are you using rpc/encoded or rpc/literal?

If you are using rpc/encoded, then you need to define the array using soapenc:Array. If you are using rpc/literal, then you need to define the array as a complex type (not an element) with a maxOccurs="unbounded" and reference the type from your message part. (You can't mix elements and types in your message parts -- the fact that your other parts reference types tells me that you are using rpc style rather than document style).

So, if you are using rpc/literal, your definition should look something like this:

<wsdl:types>
       <xsd:schema
targetNamespace="http://clearmode.com:80/ws/ConsumerProvision"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema">

              <xsd:complexType name="SOCArray">
                   <xsd:sequence>
                       <xsd:element name="SOC" type="xsd:string"
maxOccurs="unbounded"/>
                   </xsd:sequence>
              </xsd:complexType>

       </xsd:schema>
   </wsdl:types>

and add it to the message definiton:

   <wsdl:message name="addRequest">
       <wsdl:part name="username" type="xsd:string"/>
       <wsdl:part name="password" type="xsd:string"/>
       ...
       <wsdl:part name="gender" type="xsd:string"/>
       <wsdl:part name="state" type="xsd:string"/>
       <wsdl:part name="timeZone" type="xsd:string"/>
       <wsdl:part name="SOCs" type="impl:SOCArray"/>
   </wsdl:message>

Anne

On 1/6/06, Shelli D. Orton <[EMAIL PROTECTED]> wrote:
I should have mentioned in the original post, that with the second WSDL,
there is no SOCArray class.  The Java methods receive/pass a String[] array.
I was hoping by changing to that I wouldn't have the deserialization error
I'm getting.

Thanks again,
Shelli

-----Original Message-----
From: Shelli D. Orton [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 06, 2006 3:57 PM
To: axis-user@ws.apache.org
Subject: Deserialization(?) Error on String Array


Hi,

I have to make some modifications to an existing (working) webservice.  We
needed to add a new parameter to one of the existing methods, an array of
strings.  I originall created a a new type as follows in the WSDL:

    <wsdl:types>
        <xsd:schema
targetNamespace=" http://clearmode.com:80/ws/ConsumerProvision"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <xsd:element name="SOCArray">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="SOC" type="xsd:string"
maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>

        </xsd:schema>
    </wsdl:types>

and added it to the message definiton:

    <wsdl:message name="addRequest">
        <wsdl:part name="username" type="xsd:string"/>
        <wsdl:part name="password" type="xsd:string"/>
        ...
        <wsdl:part name="gender" type="xsd:string"/>
        <wsdl:part name="state" type="xsd:string"/>
        <wsdl:part name="timeZone" type="xsd:string"/>
        <wsdl:part name="SOCs" element="impl:SOCArray"/>
    </wsdl:message>

When I ran WSDL2Java, it created an SOCArray class.  During testing of the
modified service, I get the following error when I try to call the
addRequest:


Exception caught: java.lang.reflect.InvocationTargetException
AxisFault
faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
        { http://xml.apache.org/axis/}hostname:localhost

java.lang.reflect.InvocationTargetException
        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:2
21)
        at
org.apache.axis.message.SOAPFaultBuilder.endElement (SOAPFaultBuilder.java:12
8)
        at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationCo
ntext.java:1087)
        at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
        at org.apache.crimson.parser.Parser2.content(Unknown Source)
        at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
        at org.apache.crimson.parser.Parser2.content(Unknown Source)
        at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)
        at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
        at org.apache.crimson.parser.Parser2.parse(Unknown Source)
        at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext
.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
        at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke (MustUnderstandChe
cker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
        at org.apache.axis.client.Call.invoke (Call.java:2748)
        at org.apache.axis.client.Call.invoke(Call.java:2424)
        at org.apache.axis.client.Call.invoke(Call.java:2347)
        at org.apache.axis.client.Call.invoke(Call.java:1804)
        at
com.wmode.clearmode.applications.provisioningengine..ConsumerProvisionSoapBi
ndingStub.add(ConsumerProvisionSoapBindingStub.java:119)
        at
com.wmode.clearmode.applications.provisioningengine.ClientTest.main (ClientTe
st.java:111)

Since I couldn't figure out what the serialization problem was, I modified
the WSDL again to define the type like this:

    <wsdl:types>
        <xsd:schema
targetNamespace=" http://clearmode.com:80/ws/ConsumerProvision"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema ">
            <xsd:complexType name="SOCArray">
                <xsd:complexContent>
                    <xsd:restriction base="soapenc:Array">
                        <xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"/>
                    </xsd:restriction>
                </xsd:complexContent>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>

and the message to be:

    <wsdl:message name="addRequest">
        <wsdl:part name="username" type="xsd:string"/>
        <wsdl:part name="password" type="xsd:string"/>
        ...
        <wsdl:part name="gender" type="xsd:string"/>
        <wsdl:part name="state" type="xsd:string"/>
        <wsdl:part name="timeZone" type="xsd:string"/>
        <wsdl:part name="SOCs" type="impl:SOCArray"/>
    </wsdl:message>

I am still getting the same error as before when I try to call the add
method.  I've looked for solutions on the net, but the error message is
pretty vague, so it's not an easy search.

Can anybody help me identify what I'm doing wrong?

Thanks in advance,
Shelli


Reply via email to