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:[EMAIL PROTECTED]
Sent: Thursday, June 07, 2007 7:11 AM
To: [email protected]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]