The problem is that the serializer you're getting back is the 
XmlSerializableSerializer, which can serialize (but not deserialize) any 
object that implements the XmlSerializable interface. EndpointReference 
implements this interface, and since there is no other serializer for 
EndpointReference, the XmlSerializableSerializer is returned.

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());



"José Antonio Sánchez" <[EMAIL PROTECTED]> wrote on 12/18/2006 12:55:25 
PM:

> I have an operation that has an EndpointReference element as a  return
> type. As the code generator didn't detect it had a parameter and as
> that parameter was a complex type that needed serialization, I
> modified the generated proxy code to handle that. When returning, my
> service has returned the following SOAP body:
> 
> <soapenv:Body>
>         <muse-op:ServiceResponse
>             xmlns:muse-op="http://lsd.org/wsdm/SerialTest";
> xmlns:tns="http://axis2.platform.core.muse.apache.org";>
> 
<wsa:Address>http://127.0.0.1:8080/SerialTest/services/Test</wsa:Address>
>             <wsa:ReferenceParameters>
>                 <muse-wsa:ResourceId
> 
xmlns:muse-wsa="http://ws.apache.org/muse/addressing";>MuseResource-2</muse-
> wsa:ResourceId>
>             </wsa:ReferenceParameters>
>         </muse-op:ServiceResponse>
>     </soapenv:Body>
> 
> The code I'm using to invoke and to parse the response are this:
> 
> Element eprElement = invoke(_ACTIONS[0],body);
>       serial = 
SerializerRegistry.getInstance().getSerializer(EndpointReference.class);
>       return (EndpointReference)serial.fromXML(eprElement);
> 
> I've also tried with:
> 
> Element eprElement = invoke(_ACTIONS[0],body);
>       serial = 
SerializerRegistry.getInstance().getSerializer(EndpointReference.class);
>       return (EndpointReference)handler.fromXML(eprElement);
> 
> using the handler generated for that proxy.
> 
> In both cases I get:
> 
> Exception in thread "main" java.lang.UnsupportedOperationException:
> [ID = 'NoFromXML'] The XmlSerializableSerializer does not have an
> implementation of fromXML() - it only knows how to convert objects
> that implement XmlSerialiable to XML (using XmlSerializable.toXML()).
> If you want to deserialize objects of this type from XML, you should
> extend the XmlSerializableSerializer and override toXML() and
> getSerializableType().
>    at org.apache.muse.core.serializer.XmlSerializableSerializer.
> fromXML(XmlSerializableSerializer.java:51)
>    at org.lsd.wsdm.Serial.SerialProxy.test(SerialProxy.java:59)
>    at org.lsd.wsdm.Serial.SerialTest.main(SerialTest.java:39)
> -- 
> Saludos.
> José Antonio Sánchez
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to