org.apache.axis.AxisEngine Java Examples
The following examples show how to use
org.apache.axis.AxisEngine.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AxisUtil.java From j-road with Apache License 2.0 | 6 votes |
public static String serialize(Object obj) throws IOException { TypeDesc desc = TypeDesc.getTypeDescForClass(obj.getClass()); BeanSerializer serializer = new BeanSerializer(obj.getClass(), desc.getXmlType(), desc); MessageContext mctx = new MessageContext(null); mctx.setProperty(AxisEngine.PROP_ENABLE_NAMESPACE_PREFIX_OPTIMIZATION, true); mctx.setProperty(AxisEngine.PROP_SEND_XSI, true); mctx.setTypeMappingRegistry(new TypeMappingRegistryImpl()); StringWriter writer = new StringWriter(); SerializationContext ctx = new SerializationContext(writer, mctx); ctx.setPretty(false); ctx.setSendDecl(true); ctx.setDoMultiRefs(false); serializer.serialize(new QName("keha"), new AttributesImpl(), obj, ctx); return writer.getBuffer().toString(); }
Example #2
Source File: SeiFactoryImpl.java From tomee with Apache License 2.0 | 5 votes |
void initialize(Object serviceImpl, ClassLoader classLoader) throws ClassNotFoundException { this.serviceImpl = serviceImpl; Class serviceEndpointBaseClass = classLoader.loadClass(serviceEndpointClassName); serviceEndpointClass = enhanceServiceEndpointInterface(serviceEndpointBaseClass, classLoader); Class[] constructorTypes = new Class[]{classLoader.loadClass(GenericServiceEndpoint.class.getName())}; this.constructor = FastClass.create(serviceEndpointClass).getConstructor(constructorTypes); this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos); sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex() + 1]; String encodingStyle = ""; for (int i = 0; i < operationInfos.length; i++) { OperationInfo operationInfo = operationInfos[i]; Signature signature = operationInfo.getSignature(); MethodProxy methodProxy = MethodProxy.find(serviceEndpointClass, signature); if (methodProxy == null) { throw new ServerRuntimeException("No method proxy for operationInfo " + signature); } int index = methodProxy.getSuperIndex(); sortedOperationInfos[index] = operationInfo; if (operationInfo.getOperationDesc().getUse() == Use.ENCODED) { encodingStyle = org.apache.axis.Constants.URI_SOAP11_ENC; } } //register our type descriptors Service service = ((ServiceImpl) serviceImpl).getService(); AxisEngine axisEngine = service.getEngine(); TypeMappingRegistry typeMappingRegistry = axisEngine.getTypeMappingRegistry(); TypeMapping typeMapping = typeMappingRegistry.getOrMakeTypeMapping(encodingStyle); typeMapping.register(BigInteger.class, Constants.XSD_UNSIGNEDLONG, new SimpleSerializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG), new SimpleDeserializerFactory(BigInteger.class, Constants.XSD_UNSIGNEDLONG)); typeMapping.register(URI.class, Constants.XSD_ANYURI, new SimpleSerializerFactory(URI.class, Constants.XSD_ANYURI), new SimpleDeserializerFactory(URI.class, Constants.XSD_ANYURI)); //It is essential that the types be registered before the typeInfos create the serializer/deserializers. for (Iterator iter = typeInfo.iterator(); iter.hasNext(); ) { TypeInfo info = (TypeInfo) iter.next(); TypeDesc.registerTypeDescForClass(info.getClazz(), info.buildTypeDesc()); } TypeInfo.register(typeInfo, typeMapping); }
Example #3
Source File: AdsAxisEngineConfigurationFactoryTest.java From googleads-java-lib with Apache License 2.0 | 5 votes |
/** * Utility method for getting the underlying named transport from an AxisEngine and casting it to * a TargetedChain. */ private TargetedChain getTransport(AxisEngine axisEngine, String transportName) throws AxisFault { Handler transport = axisEngine.getTransport(transportName); assertNotNull("No " + transportName + " transport returned from the configured engine", transport); assertTrue("The " + transportName + " transport is not of the expected type", transport instanceof TargetedChain); return (TargetedChain) transport; }