Hi Øyvind !

> Create a startup class that just registers all your types in the
> defaultTypeMapping of the typeMappingRegistry. I am using a Spring bean
> to do this, getting the typeMappingRegistry from the xfire context.

I tried this code:

XFire xfire = XFireFactory.newInstance().getXFire();

CustomTypeMapping typeMapping = new CustomTypeMapping();
typeMapping.register(Foo.class, new QName("http://foo.com/";, "Foo",
"foo"), new FooType());
TypeMappingRegistry typeMappingRegistry = new DefaultTypeMappingRegistry();
typeMappingRegistry.registerDefault(typeMapping);

BindingProvider bindingProvider = new AegisBindingProvider(typeMappingRegistry);
ServiceFactory serviceFactory = new
ObjectServiceFactory(xfire.getTransportManager(), bindingProvider);

String serviceName = "foo";
Service service = serviceFactory.create(FooService.class, serviceName,
null, null);

service.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS, FooService.class);
xfire.getServiceRegistry().register(service);

Transport transport =
xfire.getTransportManager().getTransport(LocalTransport.BINDING_ID);
Client client = new Client(transport, service,
LocalTransport.URI_PREFIX + serviceName, LocalTransport.URI_PREFIX +
"Client");
client.setXFire(xfire);

OperationInfo op = service.getServiceInfo().getOperation("getFoo");
Object[] response = client.invoke(op, null);

I get this exception:

Exception in thread "main" org.codehaus.xfire.fault.XFireFault:
Couldn't instantiate class. com.foo.Foo
        at 
org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:147)

I'm sure I'm doing something wrong, but I have no clue where.

I also tried to get the TypeMappingRegistry and fill its default with
my user Type after service creation, but the exception is the same.

Thanks in advance !

Simon
--
http://bordet.blogspot.com

Reply via email to