Package org.apache.axis.client

Examples of org.apache.axis.client.Call


            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());
        }
View Full Code Here


      
       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);
   }
View Full Code Here

           
            // 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.class);
           
            // 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);
       
            // return null so MsgProvider will not muck with our response
            return null;
View Full Code Here

            } else {
                textToSend = args[0];
            }
           
            Service  service = new Service();
            Call     call    = (Call) service.createCall();

            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
            call.setOperationName( new QName("MyService", "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());
        }
View Full Code Here

       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());
       }
View Full Code Here

       
        order.setItemCodes(items);
        order.setQuantities(quantities);
       
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
        QName    qn      = new QName( "urn:BeanService", "Order" );

        call.registerTypeMapping(Order.class, qn,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn),       
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, 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);
View Full Code Here

     */
    private void manageService(InputStream xmlDeploymentStream)
            throws ServiceException, MalformedURLException, RemoteException
    {
        Service service = new Service();
        Call call = (Call) service.createCall();

        setupCall(call);

        call.setUseSOAPAction(true);
        call.setSOAPActionURI("AdminService");

        Object[] params = new Object[]{new SOAPBodyElement(xmlDeploymentStream)};
        Vector result = (Vector) call.invoke(params);

        if(result == null || result.isEmpty())
        {
            throw new AxisFault(Messages.getMessage("nullResponse00"));
        }
View Full Code Here

    private Map<String, Object> serviceInvoker(ModelService modelService, Map<String, Object> context) throws GenericServiceException {
        if (modelService.location == null || modelService.invoke == null)
            throw new GenericServiceException("Cannot locate service to invoke");

        Service service = null;
        Call call = null;

        try {
            service = new Service();
            call = (Call) service.createCall();
        } catch (javax.xml.rpc.JAXRPCException e) {
            throw new GenericServiceException("RPC service error", e);
        } catch (ServiceException e) {//Add by Andy.Chen 2003.01.15
            throw new GenericServiceException("RPC service error", e);
        }

        URL endPoint = null;

        try {
            endPoint = new URL(this.getLocation(modelService));
        } catch (MalformedURLException e) {
            throw new GenericServiceException("Location not a valid URL", e);
        }

        List<ModelParam> inModelParamList = modelService.getInModelParamList();

        if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + inModelParamList.size(), module);

        call.setTargetEndpointAddress(endPoint);

        if (UtilValidate.isNotEmpty(modelService.nameSpace)) {
            call.setOperationName(new QName(modelService.nameSpace, modelService.invoke));
        } else {
            call.setOperationName(modelService.invoke);
        }

        int i = 0;

        call.setOperation(call.getOperationName().getLocalPart());
        List<Object> vParams = new ArrayList<Object>();
        for (ModelParam p: inModelParamList) {
            if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke} : Parameter: " + p.name + " (" + p.mode + ") - " + i, module);

            // exclude params that ModelServiceReader insert into (internal params)
            if (!p.internal) {
                QName qName = call.getParameterTypeByName(p.name); //.getTypeMapping().getTypeQName((Class) ObjectType.classNameClassMap.get(p.type));
                call.addParameter(p.name, qName, getMode(p.mode));
                vParams.add(context.get(p.name));
            }
            i++;
        }

        call.setReturnType(XMLType.XSD_ANYTYPE);
        Object[] params=vParams.toArray(new Object[vParams.size()]);

        Object result = null;

        try {
            Debug.logInfo("[SOAPClientEngine.invoke] : Sending Call To SOAP Server", module);
            result = call.invoke(params);
        } catch (java.rmi.RemoteException e) {
            throw new GenericServiceException("RPC error", e);
        }
        if (Debug.verboseOn()) {
            Debug.log("SOAP Service Result - " + result, module);
        }

        return getResponseParams(call.getMessageContext().getResponseMessage());
    }
View Full Code Here

    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"));

        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document doc            = builder.newDocument();  
        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();
View Full Code Here

        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.setPassword( opts.getPassword() );
       
        // 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;
View Full Code Here

TOP

Related Classes of org.apache.axis.client.Call

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.