org.apache.axis.client.Service Java Examples

The following examples show how to use org.apache.axis.client.Service. 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: AxisClientPluginIT.java    From glowroot with Apache License 2.0 6 votes vote down vote up
@Override
public void transactionMarker() throws Exception {
    String endpoint = "http://localhost:" + port + "/cxf/helloWorld";

    Service service = new Service();
    Call call = (Call) service.createCall();

    call.setTargetEndpointAddress(new URL(endpoint));
    call.setPortTypeName(
            new QName("http://httpclient.plugin.agent.glowroot.org/", "HelloWorld"));
    call.setOperationName(
            new QName("http://httpclient.plugin.agent.glowroot.org/", "hello"));

    call.invoke(new Object[0]);
}
 
Example #2
Source File: SeiFactoryImpl.java    From tomee with Apache License 2.0 6 votes vote down vote up
public Remote createServiceEndpoint() throws ServiceException {
        //TODO figure out why this can't be called in readResolve!
//        synchronized (this) {
//            if (!initialized) {
//                initialize();
//                initialized = true;
//            }
//        }
        Service service = ((ServiceImpl) serviceImpl).getService();
        GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, location);
        Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos, credentialsName);
        Callback[] callbacks = new Callback[]{NoOp.INSTANCE, callback};
        Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
        try {
            return (Remote) constructor.newInstance(new Object[]{serviceEndpoint});
        } catch (InvocationTargetException e) {
            throw (ServiceException) new ServiceException("Could not construct service instance", e.getTargetException()).initCause(e);
        }
    }
 
Example #3
Source File: SeiFactoryImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
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 #4
Source File: ServiceImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
public ServiceImpl(Map portToImplementationMap, Map seiClassNameToFactoryMap) {
    this.portToImplementationMap = portToImplementationMap;
    this.seiClassNameToFactoryMap = seiClassNameToFactoryMap;

    TypeMappingRegistryImpl typeMappingRegistry = new TypeMappingRegistryImpl();
    typeMappingRegistry.doRegisterFromVersion("1.3");

    SimpleProvider engineConfiguration = new SimpleProvider(typeMappingRegistry);
    engineConfiguration.deployTransport("http", new SimpleTargetedChain(new HTTPSender()));

    AxisClientImpl engine = new AxisClientImpl(engineConfiguration, this.portToImplementationMap);

    delegate = new Service(engineConfiguration, engine);
}
 
Example #5
Source File: GenericServiceEndpoint.java    From tomee with Apache License 2.0 4 votes vote down vote up
public GenericServiceEndpoint(QName portQName, Service service, URL location) {
    this.service = service;
    cachedEndpoint = location;
    cachedPortName = portQName;

}
 
Example #6
Source File: ServiceImpl.java    From tomee with Apache License 2.0 4 votes vote down vote up
Service getService() {
    return delegate;
}
 
Example #7
Source File: WCTSoapCall.java    From webcurator with Apache License 2.0 3 votes vote down vote up
/**
 * Create a new SOAP call.
 * @param host       The host to send the message to.
 * @param port		 The port the end point is listening on.
 * @param service    The name of the service to send the message to.
 * @param operation  The operation to invoke.
 * @throws ServiceException if there is a SOAP error.
 */
public WCTSoapCall(String host, int port, String service, String operation) throws ServiceException {
	this.endPoint = "http://" + host + ":" + port + service;
	this.operation = operation;
	
	Service serv = new Service();
    call = (Call) serv.createCall();
}