ws-muse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bogdan Solomon <bsolo...@ncct.uottawa.ca>
Subject RE: [jira] Updated: (MUSE-250) Serialization of EndpointReferences (or of Element represeting an EndpointReference) strips the <wsa:EndpointReference> root
Date Mon, 16 Jul 2007 19:04:10 GMT


Vinh Nguyen (vinguye2) wrote:
> 
> My code works in both 2.1 and 2.2.  The spec you pointed out is correct.
> But, it should also be valid to have different element names with the
> same namespace.
> 
> For the Subscribe operation, Muse already sends these messages:
> 
>         <wsnt:Subscribe xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
>             <wsnt:ConsumerReference>
>                 <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing">...</wsa:Address>
>                 <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/08/addressing">
>                     <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">...</muse-wsa:Reso
> urceId>
>                 </wsa:ReferenceParameters>
>             </wsnt:ConsumerReference>
>         </wsnt:Subscribe>
> 
>         <wsnt:SubscribeResponse
>             xmlns:tns="http://axis2.platform.core.muse.apache.org"
> xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2">
>             <wsnt:SubscriptionReference>
>                 <wsa:Address>...</wsa:Address>
>                 <wsa:ReferenceParameters>
>                     <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">...</muse-wsa:Reso
> urceId>
>                 </wsa:ReferenceParameters>
>             </wsnt:SubscriptionReference>
>  
> <wsnt:CurrentTime>2007-07-13T11:25:09-07:00</wsnt:CurrentTime>
>         </wsnt:SubscribeResponse>
> 
> So your new code may work sometimes, but not all the time, like with the
> above.
> 

1. Tried to use a custom Serializer that would return the
XmlUtils(EMPTY_DOC,namespace,epr) created element. On my machine this also
failed, as the EndpointReference root continues to be stripped. What your
Serializer is doing in toXML() is the same as what the
XmlSerializableSerializer is doing:

    public Element toXML(Object obj, QName qname)
    {
        if (obj == null)
            return XmlUtils.createElement(qname);
        
        Element xml = ((XmlSerializable)obj).toXML();
        return XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, xml);
    }

so, I do not think you really need a serializer for it on the server side
(the side that is returning the EPR), as EndpointReference implements
XmlSerializable.

Did a bit more digging around the Muse source code, to figure out why the
subscription part is being serialized correctly. The Subscribe, and
SubscribeResponse messages are being generated as having the root already as
Subscribe and SubscribeResponse in their respective toXML() methods, and
inside that root is added the EndpointReference. So the EndpointReference is
not the first level element and doesn't get stripped on XML response
generation.

However doing this in my code:

Element root =
XmlUtils.createElement(XmlUtils.EMPTY_DOC,WsaConstants.ACTION_QNAME);
XmlUtils.setElement(root, WsaConstants.EPR_QNAME, epr.toXML());
return root; 

actually works, as the outside root that I create gets stripped and the
correct EndpointReference is returned.
-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28MUSE-250%29-Serialization-of-EndpointReferences-%28or-of-Element-represeting-an-EndpointReference%29-strips-the-%3Cwsa%3AEndpointReference%3E-root-tf4075785.html#a11628994
Sent from the Muse - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


Mime
View raw message