org.apache.axis.client.Service - java examples

Here are the examples of the java api org.apache.axis.client.Service taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

52 Examples 7

19 View Complete Implementation : SeiFactoryImpl.java
Copyright Apache License 2.0
Author : apache
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(serviceEndpointClreplaced, 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);
    }
}

18 View Complete Implementation : TestEncoding.java
Copyright Apache License 2.0
Author : apache
protected void setUp() throws Exception {
    if (call == null) {
        Service service = new Service();
        service.getEngine().setOption(AxisEngine.PROP_XML_ENCODING, "UTF-8");
        call = (Call) service.createCall();
        call.setTargetEndpointAddress(HttpTestUtil.getTestEndpoint("http://localhost:8080/axis/EchoHeaders.jws"));
    }
}

18 View Complete Implementation : TestClient.java
Copyright Apache License 2.0
Author : apache
/**
 * Test Client for the echo interop service.  See the main entrypoint
 * for more details on usage.
 *
 * @author Sam Ruby <[email protected]>
 */
public clreplaced TestClient {

    private static Service service = null;

    private static Call call = null;

    /**
     * Test an echo method.  Declares success if the response returns
     * true with an Object.equal comparison with the object to be sent.
     * @param method name of the method to invoke
     * @param toSend object of the correct type to be sent
     */
    private static void test(String method, Object toSend) {
    }

    /**
     * Main entry point.  Tests a variety of echo methods and reports
     * on their results.
     *
     * Arguments are of the form:
     *   -h localhost -p 8080 -s /soap/servlet/rpcrouter
     */
    public static void main(String[] args) throws Exception {
        // set up the call object
        Options opts = new Options(args);
        service = new Service();
        call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(opts.getURL()));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/Bid");
        // register the PurchaseOrder clreplaced
        QName poqn = new QName("http://www.soapinterop.org/Bid", "PurchaseOrder");
        Clreplaced cls = PurchaseOrder.clreplaced;
        call.registerTypeMapping(cls, poqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        // register the Address clreplaced
        QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
        cls = Address.clreplaced;
        call.registerTypeMapping(cls, aqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        // register the LineItem clreplaced
        QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
        cls = LineItem.clreplaced;
        call.registerTypeMapping(cls, liqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        try {
            // Default return type based on what we expect
            call.setOperationName(new QName("http://www.soapinterop.org/Bid", "Buy"));
            call.addParameter("PO", poqn, ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);
            LineItem[] li = new LineItem[2];
            li[0] = new LineItem("Tricorder", 1, "2500.95");
            li[1] = new LineItem("Phasor", 3, "7250.95");
            PurchaseOrder po = new PurchaseOrder("NCC-1701", Calendar.getInstance(), new Address("Sam Ruby", "Home", "Raleigh", "NC", "27676"), new Address("Lou Gerstner", "Work", "Armonk", "NY", "15222"), li);
            // issue the request
            String receipt = (String) call.invoke(new Object[] { po });
            System.out.println(receipt);
        } catch (Exception e) {
            System.out.println("Buy failed: " + e);
            throw e;
        }
    }
}

18 View Complete Implementation : ServiceImpl.java
Copyright Apache License 2.0
Author : apache
public clreplaced ServiceImpl implements javax.xml.rpc.Service {

    private final Service delegate;

    private final Map seiClreplacedNameToFactoryMap;

    private final Map portToImplementationMap;

    public ServiceImpl(Map portToImplementationMap, Map seiClreplacedNameToFactoryMap) {
        this.portToImplementationMap = portToImplementationMap;
        this.seiClreplacedNameToFactoryMap = seiClreplacedNameToFactoryMap;
        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);
    }

    public Remote getPort(QName qName, Clreplaced portClreplaced) throws ServiceException {
        if (qName != null) {
            String portName = qName.getLocalPart();
            Remote port = internalGetPort(portName);
            return port;
        }
        return getPort(portClreplaced);
    }

    public Remote getPort(Clreplaced portClreplaced) throws ServiceException {
        String fqcn = portClreplaced.getName();
        Remote port = internalGetPortFromClreplacedName(fqcn);
        return port;
    }

    public Call[] getCalls(QName portName) throws ServiceException {
        if (portName == null)
            throw new ServiceException("Portname cannot be null");
        SeiFactory factory = (SeiFactory) portToImplementationMap.get(portName.getLocalPart());
        if (factory == null)
            throw new ServiceException("No port for portname: " + portName);
        OperationInfo[] operationInfos = factory.getOperationInfos();
        javax.xml.rpc.Call[] array = new javax.xml.rpc.Call[operationInfos.length];
        for (int i = 0; i < operationInfos.length; i++) {
            OperationInfo operation = operationInfos[i];
            array[i] = delegate.createCall(factory.getPortQName(), operation.getOperationName());
        }
        return array;
    }

    public Call createCall(QName qName) throws ServiceException {
        return delegate.createCall(qName);
    }

    public Call createCall(QName qName, QName qName1) throws ServiceException {
        return delegate.createCall(qName, qName1);
    }

    public Call createCall(QName qName, String s) throws ServiceException {
        return delegate.createCall(qName, s);
    }

    public Call createCall() throws ServiceException {
        return delegate.createCall();
    }

    public QName getServiceName() {
        Iterator iterator = portToImplementationMap.values().iterator();
        if (!iterator.hasNext())
            return null;
        SeiFactory factory = (SeiFactory) iterator.next();
        return factory.getServiceName();
    }

    public Iterator getPorts() throws ServiceException {
        return portToImplementationMap.values().iterator();
    }

    public URL getWSDLDoreplacedentLocation() {
        Iterator iterator = portToImplementationMap.values().iterator();
        if (!iterator.hasNext())
            return null;
        SeiFactory factory = (SeiFactory) iterator.next();
        return factory.getWSDLDoreplacedentLocation();
    }

    public TypeMappingRegistry getTypeMappingRegistry() {
        throw new UnsupportedOperationException();
    // return delegate.getTypeMappingRegistry();
    }

    public HandlerRegistry getHandlerRegistry() {
        throw new UnsupportedOperationException();
    }

    Remote internalGetPort(String portName) throws ServiceException {
        if (portToImplementationMap.containsKey(portName)) {
            SeiFactory seiFactory = (SeiFactory) portToImplementationMap.get(portName);
            Remote port = seiFactory.createServiceEndpoint();
            return port;
        }
        throw new ServiceException("No port for portname: " + portName);
    }

    Remote internalGetPortFromClreplacedName(String clreplacedName) throws ServiceException {
        if (seiClreplacedNameToFactoryMap.containsKey(clreplacedName)) {
            SeiFactory seiFactory = (SeiFactory) seiClreplacedNameToFactoryMap.get(clreplacedName);
            Remote port = seiFactory.createServiceEndpoint();
            return port;
        }
        throw new ServiceException("no port for clreplaced " + clreplacedName);
    }

    Service getService() {
        return delegate;
    }
}

17 View Complete Implementation : WebServiceAxisClient.java
Copyright Apache License 2.0
Author : java110
/**
 * webservice 调用
 * @param url
 * @param function
 * @param obj
 * @param timeOut
 * @return
 * @throws Exception
 */
public static Object callWebService(String url, String function, Object[] obj, Integer timeOut) throws Exception {
    Object retObj = null;
    try {
        logger.debug("-----------开始调用Web Service-----------");
        // 创建Service对象,Service对用用于创建Call对象
        Service service = new Service();
        // 创建Call对象,Call对象用于调用服务
        Call call = (Call) service.createCall();
        // 为Call对象设置WebService的url
        call.setTargetEndpointAddress(new java.net.URL(url));
        // 为Call对象设置调用的方法名
        call.setOperationName(function);
        // 设置等待时间
        call.setTimeout(timeOut);
        // 调用WebService的方法,并获得返回值
        retObj = call.invoke(obj);
        logger.debug("-----------调用Web Service正常结束-----------");
    } catch (Exception e) {
        logger.error("-----------调用Web Service异常,原因:{}", e);
        e.printStackTrace();
        retObj = e.getMessage();
        throw new Exception("WebServiceAxisClient.callWebService throws Exception : " + e.getMessage(), e);
    }
    return retObj;
}

17 View Complete Implementation : IF2SOAPProxy.java
Copyright Apache License 2.0
Author : apache
private Call getCall() throws Exception {
    Call call = null;
    Service service = new Service();
    call = (Call) service.createCall();
    call.registerTypeMapping(Bean.clreplaced, m_beanQName, new BeanSerializerFactory(Bean.clreplaced, m_beanQName), new BeanDeserializerFactory(Bean.clreplaced, m_beanQName));
    return call;
}

16 View Complete Implementation : TestOutParams.java
Copyright Apache License 2.0
Author : apache
public clreplaced TestOutParams extends TestCase {

    /**
     * A fixed message, with no parameters
     */
    private final String message = "<?xml version=\"1.0\"?>\n" + "<soapenv:Envelope " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "<soapenv:Body>\n" + "<ns1:serviceMethod soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" " + "xmlns:ns1=\"outParamsTest\"> </ns1:serviceMethod>\n" + "</soapenv:Body></soapenv:Envelope>\n";

    private Service s_service = null;

    private Call client = null;

    private SimpleProvider provider = new SimpleProvider();

    private AxisServer server = new AxisServer(provider);

    private static boolean called = false;

    public TestOutParams(String name) {
        super(name);
        server.init();
    }

    public TestOutParams() {
        super("Test Out Params");
    }

    public void testOutputParams() throws Exception {
        // Register the service
        s_service = new Service();
        client = (Call) s_service.createCall();
        SOAPService service = new SOAPService(null, new RPCProvider(), null);
        service.setName("TestOutParamsService");
        service.setOption("clreplacedName", "test.outparams2.TestOutParams");
        service.setOption("allowedMethods", "serviceMethod");
        EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder.newFactory().getServerEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        config.deployService("outParamsTest", service);
        provider.deployService("outParamsTest", service);
        // Make sure the local transport uses the server we just configured
        client.setTransport(new LocalTransport(server));
        Message msg = new Message(message, false);
        SOAPEnvelope env = msg.getSOAPEnvelope();
        // test invocation. test Holder parameter defaults to INOUT type
        client.invoke(env);
        // method was succesfully invoked
        replacedertTrue(called);
        ServiceDesc description = null;
        OperationDesc operation = null;
        ParameterDesc parameter = null;
        description = service.getServiceDescription();
        operation = description.getOperationByName("serviceMethod");
        parameter = operation.getParamByQName(new QName("", "out1"));
        replacedertEquals(ParameterDesc.INOUT, parameter.getMode());
        // Changing output parameter to OUT type.
        parameter.setMode(ParameterDesc.OUT);
        // rest called
        called = false;
        // invoke again
        client.invoke(env);
        replacedertTrue(this.called);
    }

    public void serviceMethod(String in1, StringHolder out1) {
        called = true;
    }

    public static void main(String[] args) {
        try {
            TestOutParams tester = new TestOutParams("OutParams Test");
            tester.testOutputParams();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

16 View Complete Implementation : TestOutParams2.java
Copyright Apache License 2.0
Author : apache
/**
 * Test if operation is invoked with parameters in good order when out parameter
 * is not the last parameter. <br>
 * It makes sure that bug described at
 * http://issues.apache.org/jira/browse/AXIS-1975 is corrected.
 *
 * @author Cedric Chabanois ([email protected])
 */
public clreplaced TestOutParams2 extends TestCase {

    /**
     * A fixed message, with one parameter
     */
    private final String message = "<?xml version=\"1.0\"?>\n" + "<soapenv:Envelope " + "xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "<soapenv:Body>\n" + "<ns1:serviceMethod soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" " + "xmlns:ns1=\"outParamsTest\"><in1>18</in1></ns1:serviceMethod>\n" + "</soapenv:Body></soapenv:Envelope>\n";

    private Service s_service = null;

    private Call client = null;

    private SimpleProvider provider = new SimpleProvider();

    private AxisServer server = new AxisServer(provider);

    private static boolean called = false;

    public TestOutParams2(String name) {
        super(name);
        server.init();
    }

    public TestOutParams2() {
        super("Test Out Params");
    }

    public void testOutputParams() throws Exception {
        // Register the service
        s_service = new Service();
        client = (Call) s_service.createCall();
        SOAPService service = new SOAPService(null, new RPCProvider(), null);
        service.setName("TestOutParamsService");
        service.setOption("clreplacedName", "test.outparams2.TestOutParams2");
        service.setOption("allowedMethods", "serviceMethod");
        ServiceDesc description = new JavaServiceDesc();
        OperationDesc operation = new OperationDesc();
        operation.setName("serviceMethod");
        ParameterDesc out1 = new ParameterDesc();
        out1.setName("out1");
        out1.setMode(ParameterDesc.OUT);
        operation.addParameter(out1);
        ParameterDesc in1 = new ParameterDesc();
        in1.setName("in1");
        in1.setMode(ParameterDesc.IN);
        operation.addParameter(in1);
        description.addOperationDesc(operation);
        service.setServiceDescription(description);
        EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder.newFactory().getServerEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        config.deployService("outParamsTest", service);
        provider.deployService("outParamsTest", service);
        // Make sure the local transport uses the server we just configured
        client.setTransport(new LocalTransport(server));
        Message msg = new Message(message, false);
        SOAPEnvelope env = msg.getSOAPEnvelope();
        // invoke
        client.invoke(env);
        replacedertTrue(this.called);
    }

    public void serviceMethod(StringHolder out1, byte in1) {
        called = true;
    }

    public static void main(String[] args) {
        try {
            TestOutParams2 tester = new TestOutParams2("OutParams Test");
            tester.testOutputParams();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

16 View Complete Implementation : TestClient.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) {
    try {
        String endpoint = "http://nagoya.apache.org:5049/axis/services/echo";
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpoint));
        call.setOperationName(new QName("http://soapinterop.org/", "echoString"));
        // Call to addParameter/setReturnType as described in user-guide.html
        // call.addParameter("testParam",
        // org.apache.axis.Constants.XSD_STRING,
        // javax.xml.rpc.ParameterMode.IN);
        // call.setReturnType(org.apache.axis.Constants.XSD_STRING);
        String ret = (String) call.invoke(new Object[] { "Hello!" });
        System.out.println("Sent 'Hello!', got '" + ret + "'");
    } catch (Exception e) {
        System.err.println(e.toString());
    }
}

16 View Complete Implementation : AxisHandler.java
Copyright Apache License 2.0
Author : googleads
/**
 * Creates a SOAP client using a SOAP service descriptor.
 *
 * @param soapServiceDescriptor the descriptor to use for creating a client
 * @return the SOAP client for this descriptor
 * @throws ServiceException thrown if the SOAP client cannot be created
 */
@Override
public Stub createSoapClient(SoapServiceDescriptor soapServiceDescriptor) throws ServiceException {
    try {
        if (soapServiceDescriptor instanceof AxisCompatible) {
            AxisCompatible axisCompatibleService = (AxisCompatible) soapServiceDescriptor;
            EngineConfiguration engineConfiguration = engineConfigurationFactory.getClientEngineConfig();
            Service locator = (Service) axisCompatibleService.getLocatorClreplaced().getConstructor(new Clreplaced[] { EngineConfiguration.clreplaced }).newInstance(new Object[] { engineConfiguration });
            return (Stub) locator.getClreplaced().getMethod("getPort", Clreplaced.clreplaced).invoke(locator, soapServiceDescriptor.getInterfaceClreplaced());
        }
        throw new ServiceException("Service [" + soapServiceDescriptor + "] not compatible with Axis", null);
    } catch (SecurityException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (NoSuchMethodException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (IllegalArgumentException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (IllegalAccessException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (InvocationTargetException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (ClreplacedNotFoundException e) {
        throw new ServiceException("Unexpected Exception.", e);
    } catch (InstantiationException e) {
        throw new ServiceException("Unexpected Exception.", e);
    }
}

16 View Complete Implementation : TestOutParams.java
Copyright Apache License 2.0
Author : apache
/**
 * Test org.apache.axis.handlers.RPCDispatcher
 *
 * @author Sam Ruby <[email protected]>
 */
public clreplaced TestOutParams extends TestCase {

    private final String serviceURN = "urn:X-test-outparams";

    /**
     * A fixed message, since the return is hardcoded
     */
    private final String message = "<?xml version=\"1.0\"?>\n" + "<soap:Envelope " + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" " + "xmlns:xsi=\"" + Constants.URI_DEFAULT_SCHEMA_XSI + "\" " + "xmlns:xsd=\"" + Constants.URI_DEFAULT_SCHEMA_XSD + "\">\n" + "<soap:Body>\n" + "<ns:someMethod xmlns:ns=\"" + serviceURN + "\"/>\n" + "</soap:Body>\n" + "</soap:Envelope>\n";

    private Service s_service = null;

    private Call client = null;

    private SimpleProvider provider = new SimpleProvider();

    private AxisServer server = new AxisServer(provider);

    public TestOutParams(String name) {
        super(name);
        server.init();
    }

    /**
     * Test returning output params
     */
    public void testOutputParams() throws Exception {
        // Register the service
        Handler h = new ServiceHandler();
        s_service = new Service();
        client = (Call) s_service.createCall();
        // ??? Do we need to register the handler?
        SOAPService service = new SOAPService(h);
        provider.deployService(serviceURN, service);
        // Make sure the local transport uses the server we just configured
        client.setTransport(new LocalTransport(server));
        // Create the message context
        MessageContext msgContext = new MessageContext(server);
        // Construct the soap request
        SOAPEnvelope envelope = new SOAPEnvelope();
        msgContext.setRequestMessage(new Message(envelope));
        client.addParameter(new QName("", "string"), XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
        client.addParameter(new QName("", "out1"), XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.OUT);
        client.addParameter(new QName("", "out2"), XMLType.XSD_FLOAT, javax.xml.rpc.ParameterMode.OUT);
        client.setReturnType(XMLType.XSD_INT);
        // Invoke the Axis server
        Object ret = client.invoke(serviceURN, "method", new Object[] { "test" });
        Map outParams = client.getOutputParams();
        replacedertNotNull("No output Params returned!", outParams);
        Object param = outParams.get(new QName(null, "out1"));
        replacedertEquals("Param out1 does not equal expected value", ServiceHandler.OUTPARAM1, param);
        param = outParams.get(new QName(null, "out2"));
        replacedertEquals("Param out2 does not equal expected value", ServiceHandler.OUTPARAM2, param);
        replacedertEquals("Return value does not equal expected value", ((Integer) ret).intValue(), ServiceHandler.RESPONSE.intValue());
    }

    public static void main(String[] args) {
        try {
            TestOutParams tester = new TestOutParams("RPC test");
            tester.testOutputParams();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

15 View Complete Implementation : TestTypeDescSynch.java
Copyright Apache License 2.0
Author : apache
// this should fail
public void testFields2() throws Exception {
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.registerTypeMapping(ComplexBean3.clreplaced, new QName("foo2", "bar2"), BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced, false);
    TypeDesc desc = TypeDesc.getTypeDescForClreplaced(ComplexBean3.clreplaced);
    replacedertEquals(4, desc.getFields().length);
}

15 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public Boolean ping(String serverURL) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(serverURL));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/Ping");
        call.setOperationName(new QName("http://www.soapinterop.org/Bid", "Ping"));
        call.invoke((Object[]) null);
        return (new Boolean(true));
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

15 View Complete Implementation : WSDLScanning.java
Copyright Apache License 2.0
Author : RIGS-IT
public Object accessWGService(WebSession s, String serv, int port, String proc, String parameterName, Object parameterValue) {
    String targetNamespace = "WebGoat";
    try {
        QName serviceName = new QName(targetNamespace, serv);
        QName operationName = new QName(targetNamespace, proc);
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setOperationName(operationName);
        call.addParameter(parameterName, serviceName, ParameterMode.INOUT);
        call.setReturnType(XMLType.XSD_STRING);
        call.setUsername("guest");
        call.setPreplacedword("guest");
        call.setTargetEndpointAddress("http://localhost:" + port + "/" + s.getRequest().getContextPath() + "/services/" + serv);
        Object result = call.invoke(new Object[] { parameterValue });
        return result;
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

14 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public void unregister(String registryURL, String name) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(registryURL));
        call.setOperationName(new QName("http://www.soapinterop.org/Unregister", "Unregister"));
        call.addParameter("ServiceName", XMLType.XSD_STRING, ParameterMode.IN);
        call.invoke(new Object[] { name });
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

14 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public void register(String registryURL, samples.bidbuy.Service s) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(registryURL));
        call.setOperationName(new QName("http://www.soapinterop.org/Register", "Register"));
        call.addParameter("ServiceName", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("ServiceUrl", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("ServiceType", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("ServiceWSDL", XMLType.XSD_STRING, ParameterMode.IN);
        call.invoke(new Object[] { s.getServiceName(), s.getServiceUrl(), s.getServiceType(), s.getServiceWsdl() });
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

14 View Complete Implementation : GetQuote1.java
Copyright Apache License 2.0
Author : apache
/**
 * This will use the WSDL to prefill all of the info needed to make
 * the call.  All that's left is filling in the args to invoke().
 */
public float getQuote1(String[] args) throws Exception {
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    /* Define the service QName and port QName */
    /**
     * ***************************************
     */
    QName servQN = new QName("urn:xmltoday-delayed-quotes", "GetQuoteService");
    QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");
    /* Now use those QNames as pointers into the WSDL doc */
    /**
     * **************************************************
     */
    Service service = new Service(new URL("file:GetQuote.wsdl"), servQN);
    Call call = (Call) service.createCall(portQN, "getQuote");
    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /**
     * ****************************************************************
     */
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    /* Define some service specific properties */
    /**
     * ***************************************
     */
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    /* Get symbol and invoke the service */
    /**
     * *********************************
     */
    Object result = call.invoke(new Object[] { symbol = args[0] });
    return (((Float) result).floatValue());
}

14 View Complete Implementation : AxisResourceServiceStub.java
Copyright Apache License 2.0
Author : apache
/**
 * Call get meta data.
 *
 * @return the resource meta data
 * @throws ResourceServiceException the resource service exception
 * @see ResourceService_impl#getMetaData()
 */
@Override
public ResourceMetaData callGetMetaData() throws ResourceServiceException {
    final QName operationQName = new QName("http://uima.apache.org/resource", "getMetaData");
    final QName resourceMetaDataTypeQName = new QName("http://uima.apache.org/resourceSpecifier", "resourceMetaData");
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTimeout(getTimeout());
        call.setTargetEndpointAddress(mEndpoint);
        call.setOperationName(operationQName);
        call.registerTypeMapping(ResourceMetaData.clreplaced, resourceMetaDataTypeQName, new XmlSerializerFactory(), new XmlDeserializerFactory());
        return (ResourceMetaData) call.invoke(new Object[0]);
    } catch (ServiceException e) {
        throw new ResourceServiceException(e);
    } catch (java.rmi.RemoteException e) {
        throw new ResourceServiceException(e);
    }
}

14 View Complete Implementation : Client.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) {
    try {
        Options options = new Options(args);
        String endpointURL = options.getURL();
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpointURL));
        call.setOperationName(new QName("LogTestService", "testMethod"));
        String res = (String) call.invoke(new Object[] {});
        System.out.println(res);
    } catch (Exception e) {
        System.err.println(e.toString());
    }
}

12 View Complete Implementation : TestScopedProperties.java
Copyright Apache License 2.0
Author : apache
/**
 * Basic scoped properties test.  Set up a client side service with a
 * PropertyHandler as the request handler, then set a property on the
 * Call which we expect to be available when the request handler queries
 * the MessageContext.  Call the backend service, and make sure the
 * client handler, the server handler, and the result all agree on what
 * the values should be.
 */
public void testScopedProperties() throws Exception {
    BasicClientConfig config = new BasicClientConfig();
    PropertyHandler clientHandler = new PropertyHandler();
    SOAPService clientService = new SOAPService(clientHandler, null, null);
    config.deployService("service", clientService);
    Service s = new Service(config);
    Call call = new Call(s);
    // Set a property on the Call which we expect to be available via
    // the MessageContext in the client-side handler.
    call.setProperty(PROP_NAME, CLIENT_VALUE);
    LocalTransport transport = new LocalTransport(server);
    transport.setRemoteService("service");
    call.setTransport(transport);
    // Make the call.
    String result = (String) call.invoke("service", "testScopedProperty", new Object[] {});
    replacedertEquals("Returned scoped property wasn't correct", SERVER_VALUE, result);
    // Confirm that both the client and server side properties were
    // correctly read.
    replacedertEquals("Client-side scoped property wasn't correct", CLIENT_VALUE, clientHandler.getPropVal());
    replacedertEquals("Server-side scoped property wasn't correct", SERVER_VALUE, serverHandler.getPropVal());
}

12 View Complete Implementation : CalcClient.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    Options options = new Options(args);
    String endpoint = "http://localhost:" + options.getPort() + "/axis/Calculator.jws";
    args = options.getRemainingArgs();
    if (args == null || args.length != 3) {
        System.err.println("Usage: CalcClient <add|subtract> arg1 arg2");
        return;
    }
    String method = args[0];
    if (!(method.equals("add") || method.equals("subtract"))) {
        System.err.println("Usage: CalcClient <add|subtract> arg1 arg2");
        return;
    }
    Integer i1 = new Integer(args[1]);
    Integer i2 = new Integer(args[2]);
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(new java.net.URL(endpoint));
    call.setOperationName(method);
    call.addParameter("op1", XMLType.XSD_INT, ParameterMode.IN);
    call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_INT);
    Integer ret = (Integer) call.invoke(new Object[] { i1, i2 });
    System.out.println("Got result : " + ret);
}

12 View Complete Implementation : TestRef.java
Copyright Apache License 2.0
Author : apache
/**
 * This method sends all the files in a directory.
 *  @param The directory that is the source to send.
 *  @return True if sent and compared.
 */
public boolean tesreplaced() throws Exception {
    boolean rc = true;
    String baseLoc = "http://axis.org/attachTest";
    // holds a string of references to attachments.
    Vector refs = new Vector();
    // A new axis Service.
    Service service = new Service();
    // Create a call to the service.
    Call call = (Call) service.createCall();
    /*Un comment the below statement to do HTTP/1.1 protocol*/
    // call.setScopedProperty(MessageContext.HTTP_TRANSPORT_VERSION,HTTPConstants.HEADER_PROTOCOL_V11);
    Hashtable myhttp = new Hashtable();
    // Send extra soap headers
    myhttp.put(HTTPConstants.HEADER_CONTENT_LOCATION, baseLoc);
    /*Un comment the below to do http chunking to avoid the need to calculate content-length. (Needs HTTP/1.1)*/
    // myhttp.put(HTTPConstants.HEADER_TRANSFER_ENCODING, HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
    /*Un comment the below to force a 100-Continue... This will cause  httpsender to wait for
         * this response on a post.  If HTTP 1.1 and this is not set, *SOME* servers *MAY* reply with this anyway.
         *  Currently httpsender won't handle this situation, this will require the resp. which it will handle.
         */
    // myhttp.put(HTTPConstants.HEADER_EXPECT, HTTPConstants.HEADER_EXPECT_100_Continue);
    call.setProperty(HTTPConstants.REQUEST_HEADERS, myhttp);
    // Set the target service host and service location,
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    java.util.Stack rev = new java.util.Stack();
    // Create an attachment referenced by a generated contentId.
    AttachmentPart ap = new AttachmentPart(new javax.activation.DataHandler("Now is the time", "text/plain"));
    // reference the attachment by contentId.
    refs.add(ap.getContentIdRef());
    // create a MIME header indicating postion.
    ap.setMimeHeader(positionHTTPHeader, "" + refs.size());
    call.addAttachmentPart(ap);
    rev.push(ap);
    // Create an attachment referenced by a set contentId.
    String setContentId = "rick_did_this";
    ap = new AttachmentPart(new DataHandler(" for all good", "text/plain"));
    // new MemoryOnlyDataSource(
    ap.setContentId(setContentId);
    // reference the attachment by contentId.
    refs.add("cid:" + setContentId);
    // create a MIME header indicating postion.
    ap.setMimeHeader(positionHTTPHeader, "" + refs.size());
    call.addAttachmentPart(ap);
    rev.push(ap);
    // Create an attachment referenced by a absolute contentLocation.
    ap = new AttachmentPart(new DataHandler(" men to", "text/plain"));
    // new MemoryOnlyDataSource( " men to", "text/plain" )));
    ap.setContentLocation(baseLoc + "/firstLoc");
    // reference the attachment by contentId.
    refs.add(baseLoc + "/firstLoc");
    // create a MIME header indicating postion.
    ap.setMimeHeader(positionHTTPHeader, "" + refs.size());
    call.addAttachmentPart(ap);
    rev.push(ap);
    // Create an attachment referenced by relative location to a absolute location.
    ap = new AttachmentPart(new DataHandler(" come to", "text/plain"));
    // new MemoryOnlyDataSource( " come to", "text/plain" )));
    ap.setContentLocation(baseLoc + "/secondLoc");
    // reference the attachment by contentId.
    refs.add("secondLoc");
    // create a MIME header indicating postion.
    ap.setMimeHeader(positionHTTPHeader, "" + refs.size());
    call.addAttachmentPart(ap);
    rev.push(ap);
    // Create an attachment referenced by relative location to a relative location.
    ap = new AttachmentPart(new DataHandler(" the aid of their country.", "text/plain"));
    // new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
    ap.setContentLocation("thirdLoc");
    // reference the attachment by contentId.
    refs.add("thirdLoc");
    // create a MIME header indicating postion.
    ap.setMimeHeader(positionHTTPHeader, "" + refs.size());
    call.addAttachmentPart(ap);
    rev.push(ap);
    // Now build the message....
    // needs to match name of service.
    String namespace = "urn:attachmentsTestRef";
    StringBuffer msg = new StringBuffer("\n<attachments xmlns=\"" + namespace + "\">\n");
    for (java.util.Iterator i = refs.iterator(); i.hasNext(); ) msg.append("    <attachment href=\"" + (String) i.next() + "\"/>\n");
    msg.append("</attachments>");
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    call.setOperationStyle("doreplacedent");
    call.setOperationUse("literal");
    // Now do the call....
    Object ret = call.invoke(new Object[] { new SOAPBodyElement(new ByteArrayInputStream(msg.toString().getBytes("UTF-8"))) });
    validate(ret, call, "12345");
    // Note: that even though the attachments are sent in reverse they are still
    // retreived by reference so the ordinal will still match.
    int revc = 1;
    for (ap = (AttachmentPart) rev.pop(); ap != null; ap = rev.empty() ? null : (AttachmentPart) rev.pop()) {
        call.addAttachmentPart(ap);
    }
    // Now do the call....
    ret = call.invoke(new Object[] { new SOAPBodyElement(new ByteArrayInputStream(msg.toString().getBytes("UTF-8"))) });
    validate(ret, call, "54321");
    return rc;
}

12 View Complete Implementation : TestElem.java
Copyright Apache License 2.0
Author : apache
public static String doit(String[] args, String xml) throws Exception {
    ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
    String sURL = "http://" + args[0] + ":" + args[1] + "/axis/services/ElementService";
    QName sqn = new QName(sURL, "ElementService");
    QName pqn = new QName(sURL, "ElementService");
    // Service service=new Service(new URL("file:ElementService.wsdl"),sqn);
    Service service = new Service(new URL(sURL + "?wsdl"), sqn);
    Call call = (Call) service.createCall(pqn, "echoElement");
    Options opts = new Options(args);
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    Element elem = XMLUtils.newDoreplacedent(bais).getDoreplacedentElement();
    elem = (Element) call.invoke(new Object[] { "a string", elem });
    return (XMLUtils.ElementToString(elem));
}

12 View Complete Implementation : TestClient.java
Copyright Apache License 2.0
Author : apache
/**
 * Send a hardcoded message to the server, and print the response.
 *
 * @param args the command line arguments (mainly for specifying URL)
 * @param op an optional service argument, which will be used for
 * specifying the transport-level service
 */
public static String doTest(String[] args, String op) throws Exception {
    Options opts = new Options(args);
    String url = opts.getURL();
    String action = "EchoService";
    if (op != null)
        action = op;
    args = opts.getRemainingArgs();
    if (args != null)
        action = args[0];
    InputStream input = new ByteArrayInputStream(msg.getBytes());
    Service service = new Service();
    Call call = (Call) service.createCall();
    SOAPEnvelope env = new SOAPEnvelope(input);
    call.setTargetEndpointAddress(new URL(url));
    if (action != null) {
        call.setUseSOAPAction(true);
        call.setSOAPActionURI(action);
    }
    System.out.println("Request:\n" + msg);
    env = call.invoke(env);
    System.out.println("Response:\n" + env.toString());
    return (env.toString());
}

12 View Complete Implementation : GetQuote1.java
Copyright Apache License 2.0
Author : apache
/**
 * This will use the WSDL to prefill all of the info needed to make
 * the call.  All that's left is filling in the args to invoke().
 */
public float getQuote3(String[] args) throws Exception {
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    /* Define the service QName and port QName */
    /**
     * ***************************************
     */
    QName servQN = new QName("urn:xmltoday-delayed-quotes", "GetQuoteService");
    QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuote");
    /* Now use those QNames as pointers into the WSDL doc */
    /**
     * **************************************************
     */
    Service service = new Service(new URL("file:GetQuote.wsdl"), servQN);
    Call call = (Call) service.createCall(portQN, "getQuote");
    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /**
     * ****************************************************************
     */
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    /* Define some service specific properties */
    /**
     * ***************************************
     */
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    /* Get symbol and invoke the service */
    /**
     * *********************************
     */
    Object result = call.invoke(new Object[] { symbol = args[0] });
    result = call.invoke(new Object[] { symbol = args[0] });
    /* Reuse the call object to call the test method */
    /**
     * *********************************************
     */
    call.setOperation(portQN, "test");
    call.setReturnType(XMLType.XSD_STRING);
    System.out.println(call.invoke(new Object[] {}));
    return (((Float) result).floatValue());
}

12 View Complete Implementation : GetQuote2.java
Copyright Apache License 2.0
Author : apache
/**
 * This will use the WSDL to prefill all of the info needed to make
 * the call.  All that's left is filling in the args to invoke().
 */
public float getQuote(String[] args) throws Exception {
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    /* Define the service QName and port QName */
    /**
     * ***************************************
     */
    QName servQN = new QName("urn:xmltoday-delayed-quotes", "GetQuoteService");
    QName portQN = new QName("urn:xmltoday-delayed-quotes", "GetQuoteJava");
    /* Now use those QNames as pointers into the WSDL doc */
    /**
     * **************************************************
     */
    Service service = new Service(GetQuote2.clreplaced.getResource("GetQuote.wsdl"), servQN);
    Call call = (Call) service.createCall(portQN, "getQuote");
    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /**
     * ****************************************************************
     */
    opts.setDefaultURL(call.getTargetEndpointAddress());
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    /* Get symbol and invoke the service */
    /**
     * *********************************
     */
    Object result = call.invoke(new Object[] { symbol = args[0] });
    return (((Float) result).floatValue());
}

12 View Complete Implementation : SeiFactoryImpl.java
Copyright Apache License 2.0
Author : apache
void initialize(Object serviceImpl, ClreplacedLoader clreplacedLoader) throws ClreplacedNotFoundException {
    this.serviceImpl = serviceImpl;
    Clreplaced serviceEndpointBaseClreplaced = clreplacedLoader.loadClreplaced(serviceEndpointClreplacedName);
    serviceEndpointClreplaced = enhanceServiceEndpointInterface(serviceEndpointBaseClreplaced, clreplacedLoader);
    Clreplaced[] constructorTypes = new Clreplaced[] { clreplacedLoader.loadClreplaced(GenericServiceEndpoint.clreplaced.getName()) };
    this.constructor = FastClreplaced.create(serviceEndpointClreplaced).getConstructor(constructorTypes);
    this.handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
    sortedOperationInfos = new OperationInfo[FastClreplaced.create(serviceEndpointClreplaced).getMaxIndex() + 1];
    String encodingStyle = "";
    for (int i = 0; i < operationInfos.length; i++) {
        OperationInfo operationInfo = operationInfos[i];
        Signature signature = operationInfo.getSignature();
        MethodProxy methodProxy = MethodProxy.find(serviceEndpointClreplaced, 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.clreplaced, Constants.XSD_UNSIGNEDLONG, new SimpleSerializerFactory(BigInteger.clreplaced, Constants.XSD_UNSIGNEDLONG), new SimpleDeserializerFactory(BigInteger.clreplaced, Constants.XSD_UNSIGNEDLONG));
    typeMapping.register(URI.clreplaced, Constants.XSD_ANYURI, new SimpleSerializerFactory(URI.clreplaced, Constants.XSD_ANYURI), new SimpleDeserializerFactory(URI.clreplaced, 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.registerTypeDescForClreplaced(info.getClazz(), info.buildTypeDesc());
    }
    TypeInfo.register(typeInfo, typeMapping);
}

11 View Complete Implementation : GetQuote.java
Copyright Apache License 2.0
Author : apache
// helper function; does all the real work
public float getQuote(String[] args) throws Exception {
    Call.addTransportPackage("samples.transport");
    Call.setTransportForProtocol("tcp", TCPTransport.clreplaced);
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    String namespace = "urn:xmltoday-delayed-quotes";
    symbol = args[0];
    EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
    SimpleProvider config = new SimpleProvider(defaultConfig);
    SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
    config.deployTransport("tcp", c);
    Service service = new Service(config);
    Call call = (Call) service.createCall();
    call.setTransport(new TCPTransport());
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
    call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_FLOAT);
    // TESTING HACK BY ROBJ
    if (symbol.equals("XXX_noaction")) {
        symbol = "XXX";
    }
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    // useful option for profiling - perhaps we should remove before
    // shipping?
    String countOption = opts.isValueSet('c');
    int count = 1;
    if (countOption != null) {
        count = Integer.valueOf(countOption).intValue();
        System.out.println("Iterating " + count + " times");
    }
    Float res = new Float(0.0F);
    for (int i = 0; i < count; i++) {
        Object ret = call.invoke(new Object[] { symbol });
        if (ret instanceof String) {
            System.out.println("Received problem response from server: " + ret);
            throw new AxisFault("", (String) ret, null, null);
        }
        res = (Float) ret;
    }
    return res.floatValue();
}

11 View Complete Implementation : TargetAPIClient.java
Copyright Apache License 2.0
Author : DIA-NZ
/**
 * Invoke the service by preplaceding across an XML doreplacedent named on the
 * command line.
 */
public static void main(String[] args) throws Exception {
    try {
        // Where is the service located?
        String endpointURL = "http://localhost:8080/wct/services/urn:TargetAPI";
        // Set up the infrastructure to contact the service
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(endpointURL));
        // Set up the input message for the service
        // First, create an empty message body
        SOAPBodyElement[] requestSBElts = new SOAPBodyElement[1];
        // Now get the Xml data from a file, read it into a doreplacedent and put the doreplacedent
        // into the message body
        File paramFile = new File("c:\\temp\\WCT_API.xml");
        FileInputStream fis = new FileInputStream(paramFile);
        requestSBElts[0] = new SOAPBodyElement(XMLUtils.newDoreplacedent(fis).getDoreplacedentElement());
        // Make the call to the service
        Vector resultSBElts = (Vector) call.invoke(requestSBElts);
        // Get the response message, extract the return doreplacedent
        // from the message body and print it out as XML.
        // 
        SOAPBodyElement resElt = null;
        resElt = (SOAPBodyElement) resultSBElts.get(0);
        System.out.println(XMLUtils.ElementToString(resElt.getAsDOM()));
    } catch (AxisFault fault) {
        System.err.println("\nRECEIVED A FAULT FROM THE SERVICE:");
        System.err.println("Fault actor:   " + fault.getFaultActor());
        System.err.println("Fault code:    " + fault.getFaultCode());
        System.err.println("Fault string:\n" + fault.getFaultString());
    }
}

11 View Complete Implementation : Client.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    Options options = new Options(args);
    Order order = new Order();
    order.setCustomerName("Glen Daniels");
    order.setShippingAddress("275 Grove Street, Newton, MA");
    String[] items = new String[] { "mp3jukebox", "1600mahBattery" };
    int[] quanreplacedies = new int[] { 1, 4 };
    order.sereplacedemCodes(items);
    order.setQuanreplacedies(quanreplacedies);
    Service service = new Service();
    Call call = (Call) service.createCall();
    QName qn = new QName("urn:BeanService", "Order");
    call.registerTypeMapping(Order.clreplaced, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(Order.clreplaced, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.clreplaced, qn));
    String result;
    try {
        call.setTargetEndpointAddress(new java.net.URL(options.getURL()));
        call.setOperationName(new QName("OrderProcessor", "processOrder"));
        call.addParameter("arg1", qn, ParameterMode.IN);
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
        result = (String) call.invoke(new Object[] { order });
    } catch (AxisFault fault) {
        result = "Error : " + fault.toString();
    }
    System.out.println(result);
}

11 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public String simpleBuy(String serverURL, int quanreplacedy) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(serverURL));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/SimpleBuy");
        call.setOperationName(new QName("http://www.soapinterop.org/Bid", "SimpleBuy"));
        call.setReturnType(XMLType.XSD_STRING);
        call.addParameter("Address", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("ProductName", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("Quanreplacedy", XMLType.XSD_INT, ParameterMode.IN);
        String res = (String) call.invoke(new Object[] { "123 Main St.", "Widget", new Integer(quanreplacedy) });
        /* sd.addOutputParam("SimpleBuyResult",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_STRING); */
        return (res);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

11 View Complete Implementation : TestMsg.java
Copyright Apache License 2.0
Author : apache
public String doit(String[] args) throws Exception {
    Options opts = new Options(args);
    opts.setDefaultURL("http://localhost:8080/axis/services/MessageService");
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    SOAPBodyElement[] input = new SOAPBodyElement[3];
    input[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", "Hello"));
    input[1] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo", "e1", "World"));
    DoreplacedentBuilder builder = DoreplacedentBuilderFactory.newInstance().newDoreplacedentBuilder();
    Doreplacedent doc = builder.newDoreplacedent();
    Element cdataElem = doc.createElementNS("urn:foo", "e3");
    CDATASection cdata = doc.createCDATASection("Text with\n\tImportant  <b>  whitespace </b> and tags! ");
    cdataElem.appendChild(cdata);
    input[2] = new SOAPBodyElement(cdataElem);
    Vector elems = (Vector) call.invoke(input);
    SOAPBodyElement elem = null;
    Element e = null;
    elem = (SOAPBodyElement) elems.get(0);
    e = elem.getAsDOM();
    String str = "Res elem[0]=" + XMLUtils.ElementToString(e);
    elem = (SOAPBodyElement) elems.get(1);
    e = elem.getAsDOM();
    str = str + "Res elem[1]=" + XMLUtils.ElementToString(e);
    elem = (SOAPBodyElement) elems.get(2);
    e = elem.getAsDOM();
    str = str + "Res elem[2]=" + XMLUtils.ElementToString(e);
    return (str);
}

11 View Complete Implementation : GetQuote1.java
Copyright Apache License 2.0
Author : apache
/**
 * This will do everything manually (ie. no WSDL).
 */
public float getQuote2(String[] args) throws Exception {
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    /* Create default/empty Service and Call object */
    /**
     * ********************************************
     */
    Service service = new Service();
    Call call = (Call) service.createCall();
    /* Strange - but allows the user to change just certain portions of */
    /* the URL we're gonna use to invoke the service.  Useful when you  */
    /* want to run it thru tcpmon (ie. put  -p81 on the cmd line).      */
    /**
     * ****************************************************************
     */
    opts.setDefaultURL("http://localhost:8080/axis/servlet/AxisServlet");
    /* Set all of the stuff that would normally come from WSDL */
    /**
     * *******************************************************
     */
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    call.setUseSOAPAction(true);
    call.setSOAPActionURI("getQuote");
    call.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
    call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_FLOAT);
    /* Define some service specific properties */
    /**
     * ***************************************
     */
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    /* Get symbol and invoke the service */
    /**
     * *********************************
     */
    Object result = call.invoke(new Object[] { symbol = args[0] });
    return (((Float) result).floatValue());
}

10 View Complete Implementation : Client.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) {
    try {
        Options options = new Options(args);
        String endpointURL = options.getURL();
        String textToSend;
        args = options.getRemainingArgs();
        if ((args == null) || (args.length < 1)) {
            textToSend = "<nothing>";
        } else {
            textToSend = args[0];
        }
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(endpointURL));
        call.setOperationName(new QName("http://example3.userguide.samples", "serviceMethod"));
        call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
        String ret = (String) call.invoke(new Object[] { textToSend });
        System.out.println("You typed : " + ret);
    } catch (Exception e) {
        System.err.println(e.toString());
    }
}

10 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public String buy(String serverURL, int quanreplacedy, int numItems, double price) throws Exception {
    try {
        int i;
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(serverURL));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/Buy");
        call.setReturnType(XMLType.XSD_STRING);
        /* sd.addOutputParam("BuyResult",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_STRING); */
        // register the PurchaseOrder clreplaced
        QName poqn = new QName("http://www.soapinterop.org/Bid", "PurchaseOrder");
        Clreplaced cls = PurchaseOrder.clreplaced;
        call.registerTypeMapping(cls, poqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        // register the Address clreplaced
        QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
        cls = Address.clreplaced;
        call.registerTypeMapping(cls, aqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        // register the LineItem clreplaced
        QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
        cls = LineItem.clreplaced;
        call.registerTypeMapping(cls, liqn, BeanSerializerFactory.clreplaced, BeanDeserializerFactory.clreplaced);
        LineItem[] lineItems = new LineItem[numItems];
        for (i = 0; i < numItems; i++) lineItems[i] = new LineItem("Widget" + i, quanreplacedy, new BigDecimal(price));
        PurchaseOrder po = new PurchaseOrder("PO1", Calendar.getInstance(), new Address("Mr Big", "40 Wildwood Lane", "Weston", "CT", "06883"), new Address("Mr Big's Dad", "40 Wildwood Lane", "Weston", "CT", "06883"), lineItems);
        call.addParameter("PO", poqn, ParameterMode.IN);
        call.setOperationName(new QName("http://www.soapinterop.org/Bid", "Buy"));
        String res = (String) call.invoke(new Object[] { po });
        return (res);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

10 View Complete Implementation : JMSURLTest.java
Copyright Apache License 2.0
Author : apache
public static Float getQuote(String ticker, String username, String preplacedword) throws javax.xml.rpc.ServiceException, AxisFault {
    Float res = new Float(-1.0);
    Service service = new Service(new XMLStringProvider(wsdd));
    // create a new Call object
    Call call = (Call) service.createCall();
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
    call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_FLOAT);
    try {
        java.net.URL jmsurl = new java.net.URL(sampleJmsUrl);
        call.setTargetEndpointAddress(jmsurl);
        // set additional params on the call if desired
        call.setUsername(username);
        call.setPreplacedword(preplacedword);
        call.setTimeout(new Integer(30000));
        res = (Float) call.invoke(new Object[] { ticker });
    } catch (java.net.MalformedURLException e) {
        throw new AxisFault("Invalid JMS URL", e);
    } catch (java.rmi.RemoteException e) {
        throw new AxisFault("Failed in getQuote()", e);
    }
    return res;
}

10 View Complete Implementation : put.java
Copyright Apache License 2.0
Author : apache
static void main(String[] args) throws Exception {
    Options opts = new Options(args);
    String action = opts.isValueSet('a');
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
    if (action != null) {
        call.setUseSOAPAction(true);
        call.setSOAPActionURI(action);
    }
    args = opts.getRemainingArgs();
    for (int i = 0; i < args.length; i++) {
        FileInputStream stream = new FileInputStream(new File(args[i]));
        call.setRequestMessage(new Message(stream));
        call.invoke();
        System.out.println(call.getResponseMessage().getSOAPPartreplacedtring());
    }
}

9 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public double requestForQuote(String serverURL) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(serverURL));
        call.setOperationName(new QName("http://www.soapinterop.org/Bid", "RequestForQuote"));
        call.setReturnType(XMLType.XSD_DOUBLE);
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/RequestForQuote");
        call.addParameter("ProductName", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("Quanreplacedy", XMLType.XSD_INT, ParameterMode.IN);
        Object r = call.invoke(new Object[] { "widget", new Integer(10) });
        /*
      sd.addOutputParam("RequestForQuoteResult",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
*/
        // ??? if ( r instanceof Float ) r = ((Float)r).toString();
        if (r instanceof String)
            r = new Double((String) r);
        Double res = (Double) r;
        return (res.doubleValue());
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

8 View Complete Implementation : TestXsiType.java
Copyright Apache License 2.0
Author : apache
/**
 * More complex test which checks to confirm that we can still
 * in fact deserialize if we know the type via the Call object.
 */
public void testTypelessDeserialization() throws Exception {
    server.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
    SOAPService service = new SOAPService(new RPCProvider());
    service.setOption("clreplacedName", "test.encoding.TestXsiType");
    service.setOption("allowedMethods", "*");
    provider.deployService("TestService", service);
    // Call that same server, accessing a method we know returns
    // a double.  We should figure this out and deserialize it
    // correctly, even without the xsi:type attribute, because
    // we set the return type manually.
    Service S_service = new Service();
    Call call = (Call) S_service.createCall();
    call.setTransport(new LocalTransport(server));
    call.setReturnType(XMLType.XSD_DOUBLE);
    Object result = call.invoke("TestService", "serviceMethod", new Object[] {});
    replacedertTrue("Return value (" + result.getClreplaced().getName() + ") was not the expected type (Double)!", (result instanceof Double));
}

8 View Complete Implementation : Client.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    try {
        Options opts = new Options(args);
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
        SOAPEnvelope env = new SOAPEnvelope();
        SOAPBodyElement sbe = new SOAPBodyElement(XMLUtils.StringToElement("http://localhost:8080/LogTestService", "testMethod", ""));
        env.addBodyElement(sbe);
        env = new SignedSOAPEnvelope(env, "http://xml-security");
        System.out.println("\n============= Request ==============");
        XMLUtils.PrettyElementToStream(env.getAsDOM(), System.out);
        call.invoke(env);
        MessageContext mc = call.getMessageContext();
        System.out.println("\n============= Response ==============");
        XMLUtils.PrettyElementToStream(mc.getResponseMessage().getSOAPEnvelope().getAsDOM(), System.out);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

8 View Complete Implementation : GetInfo.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) {
    try {
        Options opts = new Options(args);
        args = opts.getRemainingArgs();
        if (args == null || args.length % 2 != 0) {
            System.err.println("Usage: GetInfo <symbol> <datatype>");
            System.exit(1);
        }
        String symbol = args[0];
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
        call.setOperationName(new QName("urn:cominfo", "getInfo"));
        call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("info", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_STRING);
        call.setUsername(opts.getUser());
        call.setPreplacedword(opts.getPreplacedword());
        String res = (String) call.invoke(new Object[] { args[0], args[1] });
        System.out.println(symbol + ": " + res);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

7 View Complete Implementation : TestSimpleSession.java
Copyright Apache License 2.0
Author : apache
/**
 * Actually test the session functionality using SOAP headers.
 *
 * Deploy a simple RPC service which returns a session-based call
 * counter.  Check it out using local transport.  To do this we need to
 * make sure the SimpleSessionHandler is deployed on the request and
 * response chains of both the client and the server.
 */
public void testSessionService() throws Exception {
    // Set up the server side
    SimpleSessionHandler sessionHandler = new SimpleSessionHandler();
    // Set a 3-second reap period, and a 3-second timeout
    sessionHandler.setReapPeriodicity(3);
    sessionHandler.setDefaultSessionTimeout(3);
    SOAPService service = new SOAPService(sessionHandler, new RPCProvider(), sessionHandler);
    service.setName("sessionTestService");
    service.setOption("scope", "session");
    service.setOption("clreplacedName", "test.session.TestSimpleSession");
    service.setOption("allowedMethods", "counter");
    EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder.newFactory().getServerEngineConfig();
    SimpleProvider config = new SimpleProvider(defaultConfig);
    config.deployService("sessionTest", service);
    AxisServer server = new AxisServer(config);
    // Set up the client side (using the WSDD above)
    Service svc = new Service(clientProvider);
    Call call = (Call) svc.createCall();
    svc.setMaintainSession(true);
    call.setTransport(new LocalTransport(server));
    // Try it - first invocation should return 1.
    Integer count = (Integer) call.invoke("sessionTest", "counter", null);
    replacedertNotNull("count was null!", count);
    replacedertEquals("count was wrong", 1, count.intValue());
    // We should have init()ed a single service object
    replacedertEquals("Wrong # of calls to init()!", 1, initCalls);
    // Next invocation should return 2, replaceduming the session-based
    // counter is working.
    count = (Integer) call.invoke("sessionTest", "counter", null);
    replacedertEquals("count was wrong", 2, count.intValue());
    // We should still have 1
    replacedertEquals("Wrong # of calls to init()!", 1, initCalls);
    // Now start fresh and confirm a new session
    Service svc2 = new Service(clientProvider);
    Call call2 = (Call) svc2.createCall();
    svc2.setMaintainSession(true);
    call2.setTransport(new LocalTransport(server));
    // New session should cause us to return 1 again.
    count = (Integer) call2.invoke("sessionTest", "counter", null);
    replacedertNotNull("count was null on third call!", count);
    replacedertEquals("New session count was incorrect", 1, count.intValue());
    // We should have init()ed 2 service objects now
    replacedertEquals("Wrong # of calls to init()!", 2, initCalls);
    // And no destroy()s yet...
    replacedertEquals("Shouldn't have called destroy() yet!", 0, destroyCalls);
    // Wait around a few seconds to let the first session time out
    Thread.sleep(4000);
    // And now we should get a new session, therefore going back to 1
    count = (Integer) call.invoke("sessionTest", "counter", null);
    replacedertEquals("count after timeout was incorrect", 1, count.intValue());
    // Check init/destroy counts
    replacedertEquals("Wrong # of calls to init()!", 3, initCalls);
    replacedertEquals("Wrong # of calls to destroy()!", 2, destroyCalls);
}

7 View Complete Implementation : v3.java
Copyright Apache License 2.0
Author : apache
public Vector lookupreplacedtring(String registryURL) throws Exception {
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(registryURL));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("http://www.soapinterop.org/Lookupreplacedtring");
        call.setOperationName(new QName("http://www.soapinterop.org/Registry", "Lookupreplacedtring"));
        call.addParameter("ServiceType", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_DOUBLE);
        String res = (String) call.invoke(new Object[] { "Bid" });
        if (res == null)
            return (null);
        StringTokenizer lineParser = new StringTokenizer(res, "\n");
        Vector services = new Vector();
        while (lineParser.hasMoreTokens()) {
            String line = (String) lineParser.nextElement();
            StringTokenizer wordParser = new StringTokenizer(line, "\t");
            samples.bidbuy.Service s = null;
            for (int i = 0; wordParser.hasMoreTokens() && i < 4; i++) switch(i) {
                case 0:
                    s = new samples.bidbuy.Service();
                    if (services == null)
                        services = new Vector();
                    services.add(s);
                    s.setServiceName((String) wordParser.nextToken());
                    break;
                case 1:
                    s.setServiceUrl((String) wordParser.nextToken());
                    break;
                case 2:
                    s.setServiceType((String) wordParser.nextToken());
                    break;
                case 3:
                    s.setServiceWsdl((String) wordParser.nextToken());
                    break;
            }
        }
        return (services);
    } catch (Exception e) {
        e.printStackTrace();
        throw e;
    }
}

7 View Complete Implementation : JMSTest.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    Options opts = new Options(args);
    // first check if we should print usage
    if ((opts.isFlagSet('?') > 0) || (opts.isFlagSet('h') > 0))
        printUsage();
    HashMap connectorMap = SimpleJMSListener.createConnectorMap(opts);
    HashMap cfMap = SimpleJMSListener.createCFMap(opts);
    String destination = opts.isValueSet('d');
    String username = opts.getUser();
    String preplacedword = opts.getPreplacedword();
    // create the jms listener
    SimpleJMSListener listener = new SimpleJMSListener(connectorMap, cfMap, destination, username, preplacedword, false);
    listener.start();
    args = opts.getRemainingArgs();
    if (args == null || args.length == 0)
        printUsage();
    Service service = new Service(new XMLStringProvider(wsdd));
    // create the transport
    JMSTransport transport = new JMSTransport(connectorMap, cfMap);
    // create a new Call object
    Call call = (Call) service.createCall();
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
    call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_FLOAT);
    call.setTransport(transport);
    // set additional params on the call if desired
    // call.setUsername(username );
    // call.setPreplacedword(preplacedword );
    // call.setProperty(JMSConstants.WAIT_FOR_RESPONSE, Boolean.FALSE);
    // call.setProperty(JMSConstants.PRIORITY, new Integer(5));
    // call.setProperty(JMSConstants.DELIVERY_MODE,
    // new Integer(javax.jms.DeliveryMode.PERSISTENT));
    // call.setProperty(JMSConstants.TIME_TO_LIVE, new Long(20000));
    call.setProperty(JMSConstants.DESTINATION, destination);
    call.setTimeout(new Integer(10000));
    Float res = new Float(0.0F);
    // invoke a call for each of the symbols and print out
    for (int i = 0; i < args.length; i++) {
        try {
            res = (Float) call.invoke(new Object[] { args[i] });
            System.out.println(args[i] + ": " + res);
        } catch (AxisFault af) {
            System.out.println(af.dumpToString());
            System.exit(1);
        }
    }
    // shutdown
    listener.shutdown();
    transport.shutdown();
}

6 View Complete Implementation : ProxyService.java
Copyright Apache License 2.0
Author : apache
/**
 * Process the given message, treating it as raw XML.
 */
public void proxyService(SOAPEnvelope env1, SOAPEnvelope env2) throws AxisFault {
    try {
        // Get the current Message Context
        MessageContext msgContext = MessageContext.getCurrentContext();
        // Look in the message context for our service
        Handler self = msgContext.getService();
        // what is our target URL?
        String dest = (String) self.getOption("URL");
        // use the server's client engine in case anything has
        // been deployed to it
        Service service = new Service();
        service.setEngine(msgContext.getAxisEngine().getClientEngine());
        Call call = (Call) service.createCall();
        SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
        // !!! FIXME
        // service.getEngine().deployTransport("tcp", c);
        // add TCP for proxy testing
        call.addTransportPackage("samples.transport");
        call.setTransportForProtocol("tcp", TCPTransport.clreplaced);
        // NOW set the client's URL (since now the tcp handler exists)
        call.setTargetEndpointAddress(new java.net.URL(dest));
        call.setRequestMessage(msgContext.getRequestMessage());
        call.invoke();
        Message msg = call.getResponseMessage();
        msgContext.setResponseMessage(msg);
    } catch (Exception exp) {
        throw AxisFault.makeFault(exp);
    }
}

6 View Complete Implementation : AxisAnalysisEngineServiceStub.java
Copyright Apache License 2.0
Author : apache
/**
 * Call process.
 *
 * @param aCAS the a CAS
 * @throws ResourceServiceException the resource service exception
 * @see replacedysisEngineServiceStub#callProcess(CAS)
 */
@Override
public void callProcess(CAS aCAS) throws ResourceServiceException {
    final QName operationQName = new QName("http://uima.apache.org/replacedysis_engine", "process");
    final QName resultSpecTypeQName = new QName("http://uima.apache.org/replacedysis_engine", "resultSpecification");
    final QName serviceDataCargoTypeQName = new QName("http://uima.apache.org/replacedysis_engine", "serviceDataCargo");
    try {
        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(getServiceEndpoint());
        call.setTimeout(getTimeout());
        call.setOperationName(operationQName);
        call.registerTypeMapping(ResultSpecification.clreplaced, resultSpecTypeQName, new XmlSerializerFactory(), new XmlDeserializerFactory());
        call.registerTypeMapping(ServiceDataCargo.clreplaced, serviceDataCargoTypeQName, new BinarySerializerFactory(mUseAttachments), new BinaryDeserializerFactory());
        // extract data from CAS to prepare for binary serialization
        // (do not send process trace)
        ServiceDataCargo dataCargo = new ServiceDataCargo(aCAS, null);
        // call service
        Object result = call.invoke(new Object[] { dataCargo, null });
        // System.out.println("Got return value of clreplaced: " + result.getClreplaced().getName()); //DEBUG
        ServiceDataCargo resultCargo = null;
        // if result was attachment, extract data and deserialize
        if (result instanceof AttachmentPart) {
            ObjectInputStream objStream = null;
            try {
                DataHandler dataHandler = AttachmentUtils.getActivationDataHandler((AttachmentPart) result);
                Object content = dataHandler.getContent();
                // System.out.println(content.getClreplaced().getName());
                objStream = new ObjectInputStream((InputStream) content);
                resultCargo = (ServiceDataCargo) objStream.readObject();
            } catch (IOException e) {
                throw new ResourceServiceException(e);
            } catch (ClreplacedNotFoundException e) {
                throw new ResourceServiceException(e);
            } finally {
                if (objStream != null) {
                    try {
                        objStream.close();
                    } catch (IOException e) {
                        throw new ResourceServiceException(e);
                    }
                }
            }
        } else if (// direct return
        result instanceof ServiceDataCargo) {
            resultCargo = (ServiceDataCargo) result;
        } else {
            throw new ResourceServiceException(ResourceServiceException.UNEXPECTED_SERVICE_RETURN_VALUE_TYPE, new Object[] { ServiceDataCargo.clreplaced.getName(), resultCargo == null ? "null" : resultCargo.getClreplaced().getName() });
        }
        // unmarshal replacedysis results into the original replacedysisProcessData object
        // (do not replace CAS type system, as it should not have been changed
        // by the service)
        resultCargo.unmarshalCas(aCAS, false);
    } catch (ServiceException e) {
        throw new ResourceServiceException(e);
    } catch (java.rmi.RemoteException e) {
        throw new ResourceServiceException(e);
    } catch (CASException e) {
        throw new ResourceServiceException(e);
    }
}

5 View Complete Implementation : FileTest.java
Copyright Apache License 2.0
Author : apache
public static void main(String[] args) throws Exception {
    FileReader reader = new FileReader();
    reader.setDaemon(true);
    reader.start();
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    String symbol = args[0];
    Service service = new Service(new XMLStringProvider(wsdd));
    Call call = (Call) service.createCall();
    call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
    call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_FLOAT);
    call.setTransport(new FileTransport());
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    call.setTimeout(new Integer(10000));
    Float res = new Float(0.0F);
    res = (Float) call.invoke(new Object[] { symbol });
    System.out.println(symbol + ": " + res);
    reader.halt();
}

5 View Complete Implementation : TestTCPTransportSample.java
Copyright Apache License 2.0
Author : apache
public void doTestStock() throws Exception {
    try {
        log.info("Testing TCP stock service...");
        GetQuote tester = new GetQuote();
        tester.getQuote(new String[] { "-l" + uri, "XXX" });
        // args[0] ;
        String symbol = "XXX";
        EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
        config.deployTransport("tcp", c);
        Service service = new Service(config);
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(uri));
        call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
        call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_FLOAT);
        Object ret = call.invoke("urn:xmltoday-delayed-quotes", "getQuote", new Object[] { symbol });
        if (ret instanceof Float) {
            Float res = (Float) ret;
            replacedertEquals("TestTCPTransportSample: stock price should be 55.25 +/- 0.000001", res.floatValue(), 55.25, 0.000001);
        } else {
            throw new replacedertionFailedError("Bad return value from TCP stock test: " + ret);
        }
    }// }
     catch (Exception e) {
        e.printStackTrace();
        throw new replacedertionFailedError("Fault returned from TCP stock test: " + e);
    }
}

4 View Complete Implementation : GetQuote.java
Copyright Apache License 2.0
Author : apache
// helper function; does all the real work
public float getQuote(String[] args) throws Exception {
    Options opts = new Options(args);
    args = opts.getRemainingArgs();
    if (args == null) {
        System.err.println("Usage: GetQuote <symbol>");
        System.exit(1);
    }
    symbol = args[0];
    // useful option for profiling - perhaps we should remove before
    // shipping?
    String countOption = opts.isValueSet('c');
    int count = 1;
    if (countOption != null) {
        count = Integer.valueOf(countOption).intValue();
        System.out.println("Iterating " + count + " times");
    }
    URL url = new URL(opts.getURL());
    String user = opts.getUser();
    String preplacedwd = opts.getPreplacedword();
    Service service = new Service();
    Float res = new Float(0.0F);
    for (int i = 0; i < count; i++) {
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(url);
        call.setOperationName(new QName("urn:xmltoday-delayed-quotes", "getQuote"));
        call.addParameter("symbol", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_FLOAT);
        // TESTING HACK BY ROBJ
        if (symbol.equals("XXX_noaction")) {
            symbol = "XXX";
        }
        call.setUsername(user);
        call.setPreplacedword(preplacedwd);
        Object ret = call.invoke(new Object[] { symbol });
        if (ret instanceof String) {
            System.out.println("Received problem response from server: " + ret);
            throw new AxisFault("", (String) ret, null, null);
        }
        res = (Float) ret;
    }
    return res.floatValue();
}

3 View Complete Implementation : EchoAttachment.java
Copyright Apache License 2.0
Author : apache
/**
 * This method sends a file as an attachment then
 *  receives it as a return.  The returned file is
 *  compared to the source.
 *  @param The filename that is the source to send.
 *  @return True if sent and compared.
 */
public boolean echo(final boolean doTheDIME, String filename) throws Exception {
    // javax.activation.MimetypesFileTypeMap map= (javax.activation.MimetypesFileTypeMap)javax.activation.MimetypesFileTypeMap.getDefaultFileTypeMap();
    // map.addMimeTypes("application/x-org-apache-axis-wsdd wsdd");
    // Create the data for the attached file.
    DataHandler dhSource = new DataHandler(new FileDataSource(filename));
    Service service = new Service();
    Call call = (Call) service.createCall();
    // Set the target service host and service location,
    call.setTargetEndpointAddress(new URL(opts.getURL()));
    // This is the target services method to invoke.
    call.setOperationName(new QName("urn:EchoAttachmentsService", "echo"));
    QName qnameAttachment = new QName("urn:EchoAttachmentsService", "DataHandler");
    // Add serializer for attachment.
    call.registerTypeMapping(// Add serializer for attachment.
    dhSource.getClreplaced(), qnameAttachment, JAFDataHandlerSerializerFactory.clreplaced, JAFDataHandlerDeserializerFactory.clreplaced);
    call.addParameter("source", qnameAttachment, // Add the file.
    ParameterMode.IN);
    call.setReturnType(qnameAttachment);
    call.setUsername(opts.getUser());
    call.setPreplacedword(opts.getPreplacedword());
    if (doTheDIME)
        call.setProperty(call.ATTACHMENT_ENCAPSULATION_FORMAT, call.ATTACHMENT_ENCAPSULATION_FORMAT_DIME);
    Object ret = call.invoke(new Object[] { dhSource });
    // Add the attachment.
    if (null == ret) {
        System.out.println("Received null ");
        throw new AxisFault("", "Received null", null, null);
    }
    if (ret instanceof String) {
        System.out.println("Received problem response from server: " + ret);
        throw new AxisFault("", (String) ret, null, null);
    }
    if (!(ret instanceof DataHandler)) {
        // The wrong type of object that what was expected.
        System.out.println("Received problem response from server:" + ret.getClreplaced().getName());
        throw new AxisFault("", "Received problem response from server:" + ret.getClreplaced().getName(), null, null);
    }
    // Still here, so far so good.
    // Now lets brute force compare the source attachment
    // to the one we received.
    DataHandler rdh = (DataHandler) ret;
    // From here we'll just treat the data resource as file.
    // Get the filename.
    String receivedfileName = rdh.getName();
    if (receivedfileName == null) {
        System.err.println("Could not get the file name.");
        throw new AxisFault("", "Could not get the file name.", null, null);
    }
    System.out.println("Going to compare the files..");
    boolean retv = compareFiles(filename, receivedfileName);
    java.io.File receivedFile = new java.io.File(receivedfileName);
    receivedFile.delete();
    return retv;
}