XFire

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0
  • Fix Version/s: 1.1
  • Component/s: Core
  • Labels:
    None
  • Number of attachments :
    0

Description

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 org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
0 {http://www.w3.org/2001/XMLSchema}string org.codehaus.xfire.aegis.type.basic.StringType@9eb1b928 string
0 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
0 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
0 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 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 org.codehaus.xfire.aegis.type.basic.StringType@9eb1b928 string
1 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
2 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
3 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 boolean
4 {http://www.w3.org/2001/XMLSchema}boolean org.codehaus.xfire.aegis.type.basic.BooleanType@5727ecc1 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.

Activity

Hide
Ted Sanne added a comment -

I have tested with 1.1-RC and the problem exists there too and can be resolved the same way

Show
Ted Sanne added a comment - I have tested with 1.1-RC and the problem exists there too and can be resolved the same way
Hide
Dan Diephouse added a comment -

Thanks Ted. Going to try and sneak this in 1.1

Show
Dan Diephouse added a comment - Thanks Ted. Going to try and sneak this in 1.1
Hide
Dan Diephouse added a comment -

Thanks Ted. This is fixed in SVN now

Show
Dan Diephouse added a comment - Thanks Ted. This is fixed in SVN now

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: