You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by Bogdan Solomon <bs...@ncct.uottawa.ca> on 2007/06/07 16:11:23 UTC

Re: Serialization problem

Using Muse 2.2.0 I get the following response body to a request:

<soapenv:Body>
        <muse-op:CreateResponse
            xmlns:muse-op="http://namespace/muse/filter/factory"
xmlns:tns="http://axis2.platform.core.muse.apache.org"><wsa:Address>http://192.168.32.23:9082/FilterManagerMuse/services/FilterManager</wsa:Address>
            <wsa:ReferenceParameters>
                <muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.org/muse/addressing">uuid:7ef949d0-ac70-56e7-8f59-1d4c2781bfe3</muse-wsa:ResourceId>
            </wsa:ReferenceParameters>
        </muse-op:CreateResponse>
    </soapenv:Body>

Trying to create an EndpointReference from the XML directly results in a
NullPointerException as the wsa:Address is null according to the
constructor.

I have solved the problem for the moment by reading the XML by hand and
generating an EPR from the address and then adding the parameter that I get,
but this is rather messy as I have to do something like this:

xml.getNextSibling().getNextSibling().getFirstChild().getNextSibling().getFirstChild()

to obtain the reference parameter. 

So I was wondering if there is a problem with the way my EPR is being
returned or if it is invalid.


Daniel Jemiolo wrote:
> 
> 
> To make an EndpointReference serializer, try the following code:
> 
> 
> public class EndpointReferenceSerializer extends XmlSerializableSerializer
> {
>         public Class getSerializableType()
>         {
>                 return EndpointReference.class;
>         }
> 
>         public Object fromXML(Element xml)
>         {
>                 return new EndpointReference(xml);
>         }
> }
> 
> 
> 
> and then, in your startup code:
> 
> SerializerRegistry reg = SerializerRegistry.getInstance();
> reg.registerSerializer(EndpointReference.class, new 
> EndpointReferenceSerializer());
> 
> 

-- 
View this message in context: http://www.nabble.com/Serialization-problem-tf2841378.html#a11008733
Sent from the Muse User mailing list archive at Nabble.com.


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


Re: Serialization problem

Posted by Bogdan Solomon <bs...@ncct.uottawa.ca>.
Found the bug in the way XmlUtils treats serialization of Elements and of
XmlSerializable. When the object to be sent as reply is one of the above
two, it embeds it's properties into the root of the reply and thus causes
the root of the EndpointReference to be lost. I'll open a JIRA item
regarding this (I have a small fix that deals with the case of the
EndpointReference).



Bogdan Solomon wrote:
> 
> 
> 
> Bogdan Solomon wrote:
>> 
>> Sorry for the long delay, but the Muse part of the project got
>> sidetracked for a bit.
>> 
>> Tried today to return an Element from my method and then to use .toXML()
>> to generate the reply. The reply sent to the client is the same, and the
>> same problem exists.
>> 
>> Here is the reply sent using .toXML()
>> 
>> <soapenv:Body>
>>         <muse-op:createResponse
>>            
>> xmlns:muse-op="http://namespace/muse/filter/factory/factoryService"
>> xmlns:tns="http://axis2.platform.core.muse.apache.org">
>>            
>> <wsa:Address>http://9.26.109.208:9080/AutonomicFilterManager/services/FilterManager</wsa:Address>
>>             <wsa:ReferenceParameters>
>>                 <muse-wsa:ResourceId
>> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">MuseResource-7</muse-wsa:ResourceId>
>>             </wsa:ReferenceParameters>
>>         </muse-op:createResponse>
>>     </soapenv:Body>
>> 
>> The changes in naming come from having regenerated the project using
>> TPTP, and I had to change some names.
>> Doing a System.out on the Element returned by .toXML() it looks like
>> this:
>> 
>> [wsa:EndpointReference: null]
>> 
>> so, I guess the problem is with the EPR.toXML() method.
>> 
>> 
> 
> Actually that value is Ok, as it should be an EndpointReference, I thought
> it was printing the Address as the root, as it does client side.
> 
> So the Element returned is correct, but it gets stripped before it reaches
> the client; I guess the problem might be inside the Axis serialization
> code, so I'll dig around some more.
> 
> 

-- 
View this message in context: http://www.nabble.com/Serialization-problem-tf2841378.html#a11583617
Sent from the Muse User mailing list archive at Nabble.com.


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


Re: Serialization problem

Posted by Bogdan Solomon <bs...@ncct.uottawa.ca>.


Bogdan Solomon wrote:
> 
> Sorry for the long delay, but the Muse part of the project got sidetracked
> for a bit.
> 
> Tried today to return an Element from my method and then to use .toXML()
> to generate the reply. The reply sent to the client is the same, and the
> same problem exists.
> 
> Here is the reply sent using .toXML()
> 
> <soapenv:Body>
>         <muse-op:createResponse
>            
> xmlns:muse-op="http://namespace/muse/filter/factory/factoryService"
> xmlns:tns="http://axis2.platform.core.muse.apache.org">
>            
> <wsa:Address>http://9.26.109.208:9080/AutonomicFilterManager/services/FilterManager</wsa:Address>
>             <wsa:ReferenceParameters>
>                 <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">MuseResource-7</muse-wsa:ResourceId>
>             </wsa:ReferenceParameters>
>         </muse-op:createResponse>
>     </soapenv:Body>
> 
> The changes in naming come from having regenerated the project using TPTP,
> and I had to change some names.
> Doing a System.out on the Element returned by .toXML() it looks like this:
> 
> [wsa:EndpointReference: null]
> 
> so, I guess the problem is with the EPR.toXML() method.
> 
> 

Actually that value is Ok, as it should be an EndpointReference, I thought
it was printing the Address as the root, as it does client side.

So the Element returned is correct, but it gets stripped before it reaches
the client; I guess the problem might be inside the Axis serialization code,
so I'll dig around some more.

-- 
View this message in context: http://www.nabble.com/Serialization-problem-tf2841378.html#a11581544
Sent from the Muse User mailing list archive at Nabble.com.


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


Re: Serialization problem

Posted by Bogdan Solomon <bs...@ncct.uottawa.ca>.
Sorry for the long delay, but the Muse part of the project got sidetracked
for a bit.

Tried today to return an Element from my method and then to use .toXML() to
generate the reply. The reply sent to the client is the same, and the same
problem exists.

Here is the reply sent using .toXML()

<soapenv:Body>
        <muse-op:createResponse
           
xmlns:muse-op="http://namespace/muse/filter/factory/factoryService"
xmlns:tns="http://axis2.platform.core.muse.apache.org">
           
<wsa:Address>http://9.26.109.208:9080/AutonomicFilterManager/services/FilterManager</wsa:Address>
            <wsa:ReferenceParameters>
                <muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.org/muse/addressing">MuseResource-7</muse-wsa:ResourceId>
            </wsa:ReferenceParameters>
        </muse-op:createResponse>
    </soapenv:Body>

The changes in naming come from having regenerated the project using TPTP,
and I had to change some names.
Doing a System.out on the Element returned by .toXML() it looks like this:

[wsa:EndpointReference: null]

so, I guess the problem is with the EPR.toXML() method.


Daniel Jemiolo wrote:
> 
> 
> looks like the EPR root element is being stripped out - as an experiment,
> try changing the method return type to Element and return the value of
> EndpointReference.toXML() and see if it works. If it does, we know we have
> a problem with the complex type serialization.
> 
> Dan
> 
> 
> 
> Bogdan Solomon <bs...@ncct.uottawa.ca> wrote on 06/07/2007 10:11:23 AM:
> 
>>
>> Using Muse 2.2.0 I get the following response body to a request:
>>
>> <soapenv:Body>
>>         <muse-op:CreateResponse
>>             xmlns:muse-op="http://namespace/muse/filter/factory"
>> xmlns:tns="http://axis2.platform.core.muse.apache.org"><wsa:
>> Address>http://192.168.32.23:
>> 9082/FilterManagerMuse/services/FilterManager</wsa:Address>
>>             <wsa:ReferenceParameters>
>>                 <muse-wsa:ResourceId
>> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">uuid:7ef949d0-
>> ac70-56e7-8f59-1d4c2781bfe3</muse-wsa:ResourceId>
>>             </wsa:ReferenceParameters>
>>         </muse-op:CreateResponse>
>>     </soapenv:Body>
>>
>> Trying to create an EndpointReference from the XML directly results in a
>> NullPointerException as the wsa:Address is null according to the
>> constructor.
>>
>> I have solved the problem for the moment by reading the XML by hand and
>> generating an EPR from the address and then adding the parameter that I
> get,
>> but this is rather messy as I have to do something like this:
>>
>> xml.getNextSibling().getNextSibling().getFirstChild().
>> getNextSibling().getFirstChild()
>>
>> to obtain the reference parameter.
>>
>> So I was wondering if there is a problem with the way my EPR is being
>> returned or if it is invalid.
>>
>>
> 

-- 
View this message in context: http://www.nabble.com/Serialization-problem-tf2841378.html#a11580705
Sent from the Muse User mailing list archive at Nabble.com.


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


RE: Serialization problem

Posted by "Vinh Nguyen (vinguye2)" <vi...@cisco.com>.
You can return an EPR, but you need to specify a serializer for it.
Here's my code:

public class EndpointReferenceSerializer implements Serializer
{
    /** */
    public Object fromXML(Element xml)
    throws SoapFault
    {
        try
        {
            return new EndpointReference(xml);
        }
        catch (Exception exc)
        {
            throw new SoapFault(exc);
        }
    }

    /** */
    public Class getSerializableType()
    {
        return EndpointReference.class;
    }

    /** */
    public Element toXML(Object obj, QName qname)
    throws SoapFault
    {
        if (obj == null)
            return XmlUtils.createElement(qname);

        Element xml = ((XmlSerializable)obj).toXML();
        return XmlUtils.createElement(XmlUtils.EMPTY_DOC, qname, xml);
    }
}
 

-----Original Message-----
From: Bogdan Solomon [mailto:bsolomon@ncct.uottawa.ca] 
Sent: Thursday, June 07, 2007 7:11 AM
To: muse-user@ws.apache.org
Subject: Re: Serialization problem


Using Muse 2.2.0 I get the following response body to a request:

<soapenv:Body>
        <muse-op:CreateResponse
            xmlns:muse-op="http://namespace/muse/filter/factory"
xmlns:tns="http://axis2.platform.core.muse.apache.org"><wsa:Address>http
://192.168.32.23:9082/FilterManagerMuse/services/FilterManager</wsa:Addr
ess>
            <wsa:ReferenceParameters>
                <muse-wsa:ResourceId
xmlns:muse-wsa="http://ws.apache.org/muse/addressing">uuid:7ef949d0-ac70
-56e7-8f59-1d4c2781bfe3</muse-wsa:ResourceId>
            </wsa:ReferenceParameters>
        </muse-op:CreateResponse>
    </soapenv:Body>

Trying to create an EndpointReference from the XML directly results in a
NullPointerException as the wsa:Address is null according to the
constructor.

I have solved the problem for the moment by reading the XML by hand and
generating an EPR from the address and then adding the parameter that I
get, but this is rather messy as I have to do something like this:

xml.getNextSibling().getNextSibling().getFirstChild().getNextSibling().g
etFirstChild()

to obtain the reference parameter. 

So I was wondering if there is a problem with the way my EPR is being
returned or if it is invalid.


Daniel Jemiolo wrote:
> 
> 
> To make an EndpointReference serializer, try the following code:
> 
> 
> public class EndpointReferenceSerializer extends 
> XmlSerializableSerializer {
>         public Class getSerializableType()
>         {
>                 return EndpointReference.class;
>         }
> 
>         public Object fromXML(Element xml)
>         {
>                 return new EndpointReference(xml);
>         }
> }
> 
> 
> 
> and then, in your startup code:
> 
> SerializerRegistry reg = SerializerRegistry.getInstance(); 
> reg.registerSerializer(EndpointReference.class, new 
> EndpointReferenceSerializer());
> 
> 

--
View this message in context:
http://www.nabble.com/Serialization-problem-tf2841378.html#a11008733
Sent from the Muse User mailing list archive at Nabble.com.


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

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


Re: changing of OASIS specs

Posted by Daniel Jemiolo <da...@us.ibm.com>.




WSN 1.2 isn't a standard, just a draft - in fact, it's a set of drafts. The
two are not compatible from an XSD standpoint, and even if they were, we'd
have to decide which of the N drafts of 1.2 we wanted to support.  ;)

Dan



<le...@bt.com> wrote on 06/07/2007 11:53:53 AM:

> Hi guys
>
> I was wondering is it possible to "downgrade" the specs used in Muse
> from say WS-BaseNotification v1.3 to v1.2? If so how would one do this
> most efficiently without breaking too much of the Muse framework.
>
>
> /Lenni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>

changing of OASIS specs

Posted by le...@bt.com.
Hi guys

I was wondering is it possible to "downgrade" the specs used in Muse
from say WS-BaseNotification v1.3 to v1.2? If so how would one do this
most efficiently without breaking too much of the Muse framework.


/Lenni

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


Re: Serialization problem

Posted by Daniel Jemiolo <da...@us.ibm.com>.






looks like the EPR root element is being stripped out - as an experiment,
try changing the method return type to Element and return the value of
EndpointReference.toXML() and see if it works. If it does, we know we have
a problem with the complex type serialization.

Dan



Bogdan Solomon <bs...@ncct.uottawa.ca> wrote on 06/07/2007 10:11:23 AM:

>
> Using Muse 2.2.0 I get the following response body to a request:
>
> <soapenv:Body>
>         <muse-op:CreateResponse
>             xmlns:muse-op="http://namespace/muse/filter/factory"
> xmlns:tns="http://axis2.platform.core.muse.apache.org"><wsa:
> Address>http://192.168.32.23:
> 9082/FilterManagerMuse/services/FilterManager</wsa:Address>
>             <wsa:ReferenceParameters>
>                 <muse-wsa:ResourceId
> xmlns:muse-wsa="http://ws.apache.org/muse/addressing">uuid:7ef949d0-
> ac70-56e7-8f59-1d4c2781bfe3</muse-wsa:ResourceId>
>             </wsa:ReferenceParameters>
>         </muse-op:CreateResponse>
>     </soapenv:Body>
>
> Trying to create an EndpointReference from the XML directly results in a
> NullPointerException as the wsa:Address is null according to the
> constructor.
>
> I have solved the problem for the moment by reading the XML by hand and
> generating an EPR from the address and then adding the parameter that I
get,
> but this is rather messy as I have to do something like this:
>
> xml.getNextSibling().getNextSibling().getFirstChild().
> getNextSibling().getFirstChild()
>
> to obtain the reference parameter.
>
> So I was wondering if there is a problem with the way my EPR is being
> returned or if it is invalid.
>
>
> Daniel Jemiolo wrote:
> >
> >
> > To make an EndpointReference serializer, try the following code:
> >
> >
> > public class EndpointReferenceSerializer extends
XmlSerializableSerializer
> > {
> >         public Class getSerializableType()
> >         {
> >                 return EndpointReference.class;
> >         }
> >
> >         public Object fromXML(Element xml)
> >         {
> >                 return new EndpointReference(xml);
> >         }
> > }
> >
> >
> >
> > and then, in your startup code:
> >
> > SerializerRegistry reg = SerializerRegistry.getInstance();
> > reg.registerSerializer(EndpointReference.class, new
> > EndpointReferenceSerializer());
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Serialization-
> problem-tf2841378.html#a11008733
> Sent from the Muse User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>