Jason, thanks for the reply...Just to clarify you had to change the generated WSDL so that it would something like:
 
<complexType name="ItemizedRequestForm">
 <sequence>
      <element maxOccurs="1" minOccurs="0" name="itemizedLines" nillable="true" type="impl:ArrayOf_impl_item_RequestFormItemizedLine" /> 
 </sequence>
</complexType>
 
<complexType name="ArrayOf_impl_item_RequestFormItemizedLine">
    <sequence>
       <element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:item_RequestFormItemizedLine"/>
    </sequence>
</complexType>
 
<complexType name="item_RequestFormItemizedLine">
    <sequence>
       <element name="RequestFormItemizedLine" type="tns1:RequestFormItemizedLine"/>
    </sequence>
</complexType>
 
So that when I run wsdl2java again it'll generate the stubs to create a SOAP request that will match the WSDL like:
 
<soapenv:Envelope>
  <soapenv:Body>
     <ItemizedRequestForm>
            <itemizedlines>
                    <item>
                        <RequestFormItemizedLine>
                        </RequestFormItemizedLine>
                    </item>
                    <item>
                        <RequestFormItemizedLine>
                        </RequestFormItemizedLine>
                    </item>
                    <item>
                        <RequestFormItemizedLine>
                        </RequestFormItemizedLine>
                    </item>
            </itemizedlines>
     </ItemizedRequestForm>
</soapenv:Body>
</soapenv:Envelope>
 
After debugging Axis, I think the root of the problem is that it can't find any mapping for the <item> element and so later on it defaults to the SimpleDeserializer, which isn't allowed to have any child elements and throws the exception. Has anyone found any other solutions, like adding a type mapping or something? For now I'll try manually changing the WSDL if that's a work around until it hopefully gets fixed in the next release.
 
Ben


From: Jason Cwik [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 06, 2005 10:49 AM
To: [email protected]
Subject: Re: Urgent Array issue - Incorrect DOC/LIT SOAP request from client?

I've run into this problem too. (http://marc.theaimsgroup.com/?l=axis-user&m=113336992622255&w=2) It seems that whenever running WSDL2Java things appear correct, but the if you look at the dynamic WSDL generated by Axis it renames message elements to "item".  This only appears to happen when the message only includes one unbounded element in its complex type.  The workaround that I used was to add another element to the complex type; then axis seems to work fine.

On 12/6/05, Ben Reif <[EMAIL PROTECTED]> wrote:
I'm trying to create a DOC/LIT style service that uses an object that contains getters and setters for a List of objects.
The List contains RequestFormItemizedLine objects. The containing object, ItemizedRequestForm, looks like:
 
public class ItemizedRequestForm{
        public List getItemizedLines()
        public void setItemizedLines(List)
}
 
Anyway, I run the java2wsdl and get this in my WSDL:
 
<complexType name="ItemizedRequestForm">
 <sequence>
    ....
      <element maxOccurs="1" minOccurs="0" name="itemizedLines" nillable="true" type="impl:ArrayOf_tns1_RequestFormItemizedLine" />
    ....
 </sequence>
</complexType    
 
 

<complexType name="ArrayOf_tns1_RequestFormItemizedLine">
 <sequence>
  <element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:RequestFormItemizedLine" />
 </sequence>
</complexType>
 
<complexType name="RequestFormItemizedLine">
 <sequence>
        ....
 </sequence>
</complexType>
 

Then I run wsdl2java (have tried both wrapArrays=true/false) to generate the client stubs, and at runtime I get a SOAP request that looks like:
 

<?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:xsi=" http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <ItemizedRequestForm4 xmlns="
http://form.pe.domain.momentum.ams.com ">
        .....
      <itemizedLines>
        <ns1:item xmlns:ns1="
http://MomentumWebServices/service/ItemizedRequestFormService ">
                .....
        </item>
      </itemizedLines>
    </ItemizedRequestForm4>
    .....
  </Body>
</Envelope>
   
 
When the SOAP message is being processed on the server this results in an exception:
 
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
 

My first question has to do with the WSDL, why does it automatically use the name "item" when it's not a valid field in the object?  My second question
is in the generated stubs, why does is assume the target namespace for item? This is incorrect since it doesn't corespond  to any object in that namespace,
and it seem like on the server it can't find the deserializer for that combination and defaults to the SimpleDeserializer, which throws the error.
Shouldn't the SOAP request really look something like (assuming there were 3 RequestFormItemizedLine objects in the List):
 

<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <ItemizedRequestForm4 xmlns="
http://form.pe.domain.momentum.ams.com ">
        .....
      <itemizedLines xmlns="
http://MomentumWebServices/service/ItemizedRequestFormService">
        <ns1:RequestFormItemizedLine xmlns:ns1="
http://form.pe.domain.momentum.ams.com ">
                .....
        </RequestFormItemizedLine>
        <ns1:RequestFormItemizedLine xmlns:ns1="
http://form.pe.domain.momentum.ams.com ">
                .....
        </RequestFormItemizedLine>
        <ns1:RequestFormItemizedLine xmlns:ns1="
http://form.pe.domain.momentum.ams.com ">
                .....
        </RequestFormItemizedLine>
      </itemizedLines>
    </ItemizedRequestForm4>
    .....
  </Body>
</Envelope>
 

Could someone please let me know if this is correct or not, and how to get the client to send the SOAP request in the correct way?
 
-Thanks in advance
 
Ben
 
 

Reply via email to