[
https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488771
]
Vinh Nguyen commented on MUSE-215:
----------------------------------
After studying the behavior more, hopefully I'm closer to the culprit now.
Suppose I have an operation with a single object parameter. When Muse calls
the serializer, it passes the QName of the object as defined in the wsdl. This
is ok because the result xml has the right object name.
But, when I have an operation that contains an array parameter, Muse calls the
serializer for each object...but passes the QName of the array itself. It is
not passing the QName of the array item. The result element has the array's
name, not the array item's name. So on the receiver side, I am unable to get
the xml back to the proper object type, because the original object name has
been lost.
I haven't been able to debug the Muse code yet, but this explains why, when I
have an operation get(String Get_queryName, PropertyNameAndValue[]
Get_arguments), the output xml looks like:
<soap:Body>
<pfx1:Get xmlns:pfx1="http://schemas.cisco.com/Query">
<pfx1:Get_queryName>TestQueryName</pfx1:Get_queryName>
<pfx1:Get_arguments>
<pfx1:Get_arguments>
....
</pfx1:Get_arguments>
<pfx1:Get_arguments>
....
</pfx1:Get_arguments>
</pfx1:Get_arguments>
</pfx1:Get>
</soap:Body>
> Serializer.toXML() requires unnecessary parent element with specified QName
> ---------------------------------------------------------------------------
>
> Key: MUSE-215
> URL: https://issues.apache.org/jira/browse/MUSE-215
> Project: Muse
> Issue Type: Bug
> Affects Versions: 2.2.0
> Environment: Muse 2.2.0, JDK 1.5.0
> Reporter: Vinh Nguyen
> Assigned To: Dan Jemiolo
> Fix For: 2.3.0
>
> Attachments: TestApp.zip
>
>
> The issue applies to all Muse releases so far.
> I have this Get operation defined as:
> <xs:element name="Get_queryName" type="xs:string"/>
> <xs:element name="Get_arguments"
> type="tns:PropertyNameAndStringValueType"/>
> <xs:element name="Get">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="tns:Get_queryName" minOccurs="1"
> maxOccurs="1"/>
> <xs:element ref="tns:Get_arguments" minOccurs="0"
> maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> The java method is:
> public String get(String queryName, PropertyNameAndStringValueType[]
> queryArgs)
> There is an issue with the Serializer.toXML(Object, QName) method. It
> requires the Element returned to have the QName specified in the parameter.
> This forces my code to create a parent element with that QName, and then set
> the real xml element as the child. This causes an unnecessary xml layer on
> the data, which the fromXML() method must strip away to get at the real data.
> The effect is two problems:
> 1) When an array of PropertyNameAndStringValueType objects is sent, each
> object is wrapped in a parent element with the QName passed into toXML() by
> Muse. The result is no longer a list of PropertyNameAndStringValueType
> objects, but a list of <Get_arguments> objects.
> 2) The dependency on toXML() to add an extra element wrapper and fromXML() to
> strip the wrapper, requires all clients to use the custom serializers.
> Otherwise, if a client sends a properly formatted xml request without the
> unnecessary list wrappers, and the server calls fromXML() to strip expected
> wrappers, data will be lost and errors will occur.
> For example, I expected my client output to have one <Get_arguments>
> containing a list of <PropertyNameAndStringValueType> elements like this:
> <soap:Body>
> <pfx1:Get xmlns:pfx1="http://schemas.cisco.com/Query">
> <pfx1:Get_queryName>TestQueryName</pfx1:Get_queryName>
> <pfx1:Get_arguments>
> <quer:PropertyNameAndStringValue
> xmlns:quer="http://schemas.cisco.com/Query">
> <quer:propertyName>PropertyName 1</quer:propertyName>
> <quer:stringValue>String value 1</quer:stringValue>
> </quer:PropertyNameAndStringValue>
> <quer:PropertyNameAndStringValue
> xmlns:quer="http://schemas.cisco.com/Query">
> <quer:propertyName>PropertyName 2</quer:propertyName>
> <quer:stringValue>String value 2</quer:stringValue>
> </quer:PropertyNameAndStringValue>
> </pfx1:Get_arguments>
> </pfx1:Get>
> </soap:Body>
> But instead, I get one <Get_arguments> containing a list of other
> <Get_arguments> elements:
> <soap:Body>
> <pfx1:Get xmlns:pfx1="http://schemas.cisco.com/Query">
> <pfx1:Get_queryName>TestQueryName</pfx1:Get_queryName>
> <pfx1:Get_arguments>
> <pfx1:Get_arguments>
> <quer:PropertyNameAndStringValue
> xmlns:quer="http://schemas.cisco.com/Query">
> <quer:propertyName>PropertyName 1</quer:propertyName>
> <quer:stringValue>String value 1</quer:stringValue>
> </quer:PropertyNameAndStringValue>
> </pfx1:Get_arguments>
> <pfx1:Get_arguments>
> <quer:PropertyNameAndStringValue
> xmlns:quer="http://schemas.cisco.com/Query">
> <quer:propertyName>PropertyName 2</quer:propertyName>
> <quer:stringValue>String value 2</quer:stringValue>
> </quer:PropertyNameAndStringValue>
> </pfx1:Get_arguments>
> </pfx1:Get_arguments>
> </pfx1:Get>
> </soap:Body>
> Attached is my test program.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]