You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Vinh Nguyen (JIRA)" <ji...@apache.org> on 2007/03/22 01:17:32 UTC
[jira] Created: (MUSE-215) Serializer.toXML() requires unnecessary
parent element with specified QName
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
Environment: Muse 2.2.0, JDK 1.5.0
Reporter: Vinh Nguyen
Assigned To: Dan Jemiolo
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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Commented: (MUSE-215) Serializer.toXML() requires
unnecessary parent element with specified QName
Posted by "Vinh Nguyen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495884 ]
Vinh Nguyen commented on MUSE-215:
----------------------------------
After further research, this might not be a bug at all, but an intended design limitation of Muse. My schema above defines a Get operation with a parameter named "Get_arguments". The parameter type is an array of PropertyNameAndStringValueTypes. I realize that in this schema, the array name is the parameter name, but the array elements are not named at all. So the xml output that I am seeing really is the proper output -- the array elements have the same name as the array itself.
This follows the Java convention where you can name an array instance (by the name of the variable used to represent the array), but you can't actually name each array element. So Muse is following this convention.
But, in a wsdl/xsd, you are allowed to name the array elements, too, like in this schema:
<xs:element name="Get_arguments">
<xs:complexType>
<xs:sequence>
<xs:element name="ListItem" type="tns:PropertyNameAndStringValueType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Here, the array name is "Get_arguments", and the array elements are named "ListItem".
But, Muse uses the least common denominator approach, so during serialization, it only references the parameter name. So each array element is serialized using the name of the array itself.
In the generated client proxies, only the request parameter names are stored. The names of any elements in the parameter itself (ie. array elements) are not stored. So digging further in the Muse code, ReflectionProxyHandler.toXML() serializes the array parameter by passing only the parameter name to the serializer. SerializerRegistry.registerSerializer() only maps an ArraySerializer instance with the array class of the type to be serialized. And in ArraySerializer.toXML(), it only has access to the array name.
It would be nice if Muse does support the naming of array elements, but I know it will take a lot more work to fit this into the current serialization structure. For now, I realize this is not a bug, and my serializer code follows the Muse convention for serialization, which compensates for this limitation.
So I guess it's ok to close this issue, if the Muse team decides that no further fixes will be made.
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Closed: (MUSE-215) Serializer.toXML() requires unnecessary
parent element with specified QName
Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Jemiolo closed MUSE-215.
----------------------------
Resolution: Won't Fix
closed per vinh's request
> 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
> Assignee: 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Updated: (MUSE-215) Serializer.toXML() requires unnecessary
parent element with specified QName
Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dan Jemiolo updated MUSE-215:
-----------------------------
Fix Version/s: 2.3.0
Affects Version/s: 2.2.0
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Commented: (MUSE-215) Serializer.toXML() requires
unnecessary parent element with specified QName
Posted by "Vinh Nguyen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483802 ]
Vinh Nguyen commented on MUSE-215:
----------------------------------
I think I understand the problem now.
When Muse creates the SOAP xml before it calls a serializer, the DOM xml tree has its own document root.
When my serializer converts an object to xml, the initial Element result also has its own document root.
Finally, when Muse tries to combine my Element into the SOAP xml, it gets an exception about combining nodes from different documents.
For example, suppose my code ignores the QName specified by Muse:
public Element toXML(Object obj, QName name)
throws SoapFault
{
try
{
PropertyNameAndStringValueType type = (PropertyNameAndStringValueType)obj;
return XmlUtils.getFirstElement(type.newDomNode());
}
catch (Exception exc)
{
throw new SoapFault(exc);
}
}
Then I get this exception:
org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
at org.apache.muse.core.serializer.ArraySerializer.toXML(ArraySerializer.java:175)
To get around this, the serializer is forced to create an Element that holds the QName passed in by Muse.
This way, Muse can easily add the serialized result into the SOAP xml without any DOM issues.
In order to do this, I have to first create an empty parent Element with the given QName.
Then, in order to not lose any data, the actual serialized result is added as a child Element. Like this:
public Element toXML(Object obj, QName name)
throws SoapFault
{
try
{
PropertyNameAndStringValueType type = (PropertyNameAndStringValueType)obj;
Element parent = XmlUtils.createElement(name);
Element child = XmlUtils.getFirstElement(type.newDomNode());
parent.appendChild(parent.getOwnerDocument().importNode(child, true));
return parent;
}
catch (Exception exc)
{
throw new SoapFault(exc);
}
}
This will avoid issues with Muse during serialization. But, the problem is compounded now because later,
when the xml needs to be deserialized back to the Object, I must first strip off the extra layer before I
can get to the real Element. Like this:
public Object fromXML(Element xml)
throws SoapFault
{
try
{
// Muse may provide an Element that has an extra wrapper, so search for the actual Element we want.
// Then parse and convert.
xml = XmlUtils.getElement(xml, PropertyNameAndStringValueDocument.type.getDocumentElementName());
return PropertyNameAndStringValueDocument.Factory.parse(xml).getPropertyNameAndStringValue();
}
catch (Exception exc)
{
throw new SoapFault(exc);
}
}
So now, because of this extra layer, toXML() and fromXML() are dependent on each other, and a client must
either use these serializers, or must work around this bug by adding the extra layer when sending data.
Ideally, the serializer should not need to know what the caller is going to do with the result.
It should just translate an object exactly to its xml representation, and return just that.
It should be in the Muse layer just above the serializer that does the merging of Elements from
different document roots. For example, if my operation takes in a list of PropertyNameAndStringValueType objects,
the Muse logic should be:
PropertyNameAndStringValue obj =
PropertyNameAndStringValueTypeSerializer serializer = ...
Element objXML = serializer.toXML(obj);
Element operationBody = ...
operationBody.appendChild(operationBody.getOwnerDocument().importNode(objXML, true));
Note that serializer.toXML() does not need to pass in any QName since no extra QName needs to be involved.
Also, the result of toXML() should be the exact xml representation of the given object itself.
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Commented: (MUSE-215) Serializer.toXML() requires
unnecessary parent element with specified QName
Posted by "Vinh Nguyen (JIRA)" <ji...@apache.org>.
[ 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Commented: (MUSE-215) Serializer.toXML() requires
unnecessary parent element with specified QName
Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
[ 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Updated: (MUSE-215) Serializer.toXML() requires unnecessary
parent element with specified QName
Posted by "Vinh Nguyen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vinh Nguyen updated MUSE-215:
-----------------------------
Attachment: TestApp.zip
Test program for query arguments array test. Just need to run the com.cisco.testapp.Main class, which will show the client output. The Muse server app is not needed for this test.
> 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
> Environment: Muse 2.2.0, JDK 1.5.0
> Reporter: Vinh Nguyen
> Assigned To: Dan Jemiolo
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org
[jira] Commented: (MUSE-215) Serializer.toXML() requires
unnecessary parent element with specified QName
Posted by "Vinh Nguyen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MUSE-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499924 ]
Vinh Nguyen commented on MUSE-215:
----------------------------------
We can close this issue. I don't have any proposed code for the new array system at this time. Thanks Dan!
> 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
> Assignee: 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org