WSDLServiceBuilder and MessagePartContainer do not respect correct ordering of 
parts when using dynamic client
--------------------------------------------------------------------------------------------------------------

         Key: XFIRE-393
         URL: http://jira.codehaus.org/browse/XFIRE-393
     Project: XFire
        Type: Bug

  Components: Core  
    Versions: 1.0    
    Reporter: Ted Sanne
 Assigned to: Dan Diephouse 


When using the dynamic client, the correct ordering of the parts in a message:

The fragment of the wsdl looks like this:

<wsdl:message name="getBatchDetailsRequest">
    <wsdl:part name="localId" type="xsd:string" />
    <wsdl:part name="trdProperties" type="xsd:boolean" />
    <wsdl:part name="propertyLog" type="xsd:boolean" />
    <wsdl:part name="stationList" type="xsd:boolean" />
    <wsdl:part name="transList" type="xsd:boolean" />
  </wsdl:message>

But when I print out the message parts on the client, i get the following:

Operation: getBatchDetails
        0 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        0 {http://www.w3.org/2001/XMLSchema}string [EMAIL PROTECTED] string
        0 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        0 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        0 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean

As you can see, the first and second argument has switched places.
Also, all message parts have an index of 0!

To fix the ordering problem, the createMessageParts(MessagePartContainer info, 
Message msg) in org.codehaus.xfire.wsdl11.parser.WSDLServiceBuilder should be 
changed from:

Map parts = msg.getParts();
for (Iterator itr = parts.values().iterator(); itr.hasNext();)
...

to

List parts = msg.getOrderedParts(null);
for (Iterator itr = parts.iterator(); itr.hasNext();)
....


In addition, addMessagePart(MessagePartInfo part) in 
org.codehaus.xfire.service.MessagePartContainer should look like this:
public void addMessagePart(MessagePartInfo part)
    {
        messageParts.put(part.getName(), part);
        part.setIndex(messagePartList.size());
        messagePartList.add(part);
    }

Without these changes, I get a ClassCastException since the BoolType is trying 
to write a string.

After testing these changes I get the following when printing the parts:
Operation: getBatchDetails
        0 {http://www.w3.org/2001/XMLSchema}string [EMAIL PROTECTED] string
        1 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        2 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        3 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean
        4 {http://www.w3.org/2001/XMLSchema}boolean [EMAIL PROTECTED] boolean

I tested this on the 1.0 code, but after a quick compare, the problem seems to 
be on the 1.1-RC1 code too.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to