/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ ClassUtil.verifyMustOverride(BeanDeserializerFactory.class, this, "withConfig"); return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ if (getClass() != BeanDeserializerFactory.class) { throw new IllegalStateException("Subtype of BeanDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new BeanDeserializerFactory(config); }
/** * Method used by module registration functionality, to construct a new bean * deserializer factory * with different configuration settings. */ @Override public DeserializerFactory withConfig(DeserializerFactoryConfig config) { if (_factoryConfig == config) { return this; } /* 22-Nov-2010, tatu: Handling of subtypes is tricky if we do immutable-with-copy-ctor; * and we pretty much have to here either choose between losing subtype instance * when registering additional deserializers, or losing deserializers. * Instead, let's actually just throw an error if this method is called when subtype * has not properly overridden this method; this to indicate problem as soon as possible. */ ClassUtil.verifyMustOverride(BeanDeserializerFactory.class, this, "withConfig"); return new BeanDeserializerFactory(config); }
public final class WSUtils { public static void handleSerialization(Call call, String ns, String bean, Class cl) { QName qn = new QName(ns, bean); call.registerTypeMapping(cl, qn, new BeanSerializerFactory(cl, qn), new BeanDeserializerFactory(cl, qn)); } }
public class MyServiceFactoryBean extends JaxRpcPortProxyFactoryBean { protected void postProcessJaxRpcService(Service service) { TypeMappingRegistry registry = service.getTypeMappingRegistry(); TypeMapping mapping = registry.createTypeMapping(); QName qName = new QName("http://com/myService", "Foo"); mapping.register(Foo.class, qName, new BeanSerializerFactory(Foo.class, qName), new BeanDeserializerFactory(Foo.class, qName)); } }
try { String endpoint ="http://RequestUrl"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); QName q = new QName ("http://Url", "FrsFileSoapDO"); // step 1 BeanSerializerFactory bsf = new BeanSerializerFactory(FrsFileSoapDO.class,q); // step 2 BeanDeserializerFactory bdf = new BeanDeserializerFactory(FrsFileSoapDO.class,q); // step 3 call.registerTypeMapping(FrsFileSoapDO.class,q, bsf, bdf); //step 4 call.setOperationName(new QName(endpoint, "getFrsFileData")); FrsFileSoapDO s = (FrsFileSoapDO) call.invoke(new Object[] { "24BB7","frs1001" } ); System.out.println(s.getFilename()); }
public class AxisClient { public static void main(String[] args) throws Exception { String endPoint = "http://localhost:8080/StudentServiceImplService/StudentServiceImpl"; Service service2 = new Service(); Call call2 = (Call) service2.createCall(); call2.setTargetEndpointAddress(new java.net.URL(endPoint)); call2.setOperationName(new QName("http://services.tuto.java.com/","getStudents")); call2.setReturnType(new QName("","student"), Student.class); call2.setReturnType(new QName("", "student")); call2.registerTypeMapping(Student.class, new QName("", "student"), null,new BeanDeserializerFactory(Student.class, new QName("", "student"))); List<Student> students = (List<Student>) call2.invoke(new Object[0]); for (Student student : students) { System.out.println(student); } } }
Service service = new Service(); Call call = (Call) service.createCall(); QName q = new QName("http://rpc.xml.coldfusion", "QueryBean"); BeanSerializerFactory bsf = new BeanSerializerFactory(QueryBean.class, q); // step 2 BeanDeserializerFactory bdf = new BeanDeserializerFactory(QueryBean.class, q); // step 3 call.registerTypeMapping(QueryBean.class, q, bsf, bdf); //step 4 call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName(endpoint, "getReportContent")); QueryBean bean = (QueryBean) call.invoke( new Object[] { "142", "5088721" });
ServiceFactory factory1 = ServiceFactory.newInstance(); QName qnTick = new QName("http://soapinterop.org/xsd", "ArrayOfString"); Service serviceTickReq = factory1.createService(qnTick); // Service serviceTickReq = new org.apache.axis.client.Service(); TypeMappingRegistry tmr = (TypeMappingRegistry) serviceTickReq .getTypeMappingRegistry(); TypeMapping tm = (TypeMapping) tmr.getDefaultTypeMapping(); tm.register(ArrayOfString.class, qnTick, new BeanSerializerFactory( ArrayOfString.class, qnTick), new BeanDeserializerFactory( ArrayOfString.class, qnTick)); TypeMappingRegistry tmr1 = (TypeMappingRegistry) serviceTickReq .getTypeMappingRegistry(); TypeMapping tm1 = (TypeMapping) tmr1.getDefaultTypeMapping(); tm1.register(String[].class, qnTick, new BeanSerializerFactory( String[].class, qnTick), new BeanDeserializerFactory( String[].class, qnTick));