[
https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497519
]
Dan Jemiolo commented on MUSE-215:
----------------------------------
You're right about the way Muse handles arrays - since there's no standard way
to define/parse arrays in XSD, we just define a simple one that follows the
convention you described in your second paragraph. It's definitely not perfect,
but it's the best we could do while trying to reuse our other serializer code
as much as possible.
We're definitely open to changes in the array parsing/conventions, but as
you've seen, it's some sticky code - there are lot of different test cases for
XSD/WSDL arrays and multiple parameters, and you need to take extra care to
make sure the changes do what you want.
Let us know if you'd like to keep this open and propose a new system for array
values.
> 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]