/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': cannot instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': cannot instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(config); }
/** * Method used by module registration functionality, to attach additional * serializer providers into this serializer factory. This is typically * handled by constructing a new instance with additional serializers, * to ensure thread-safe access. */ @Override public SerializerFactory withConfig(SerializerFactoryConfig 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 serializers, or losing serializers. * 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() != BeanSerializerFactory.class) { throw new IllegalStateException("Subtype of BeanSerializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalSerializers': can not instantiate subtype with " +"additional serializer definitions"); } return new BeanSerializerFactory(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)); } }
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 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)); } }
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));