Package org.apache.axis.client

Examples of org.apache.axis.client.ServiceClient


        }

      args = opts.getRemainingArgs();
      if ( args != null ) action = args[0];

      ServiceClient client = new ServiceClient(new HTTPTransport());
      client.set(HTTPTransport.URL, url);
      client.set(HTTPTransport.ACTION, action);

      Message        reqMsg      = new Message( msg );
      Message        resMsg     = null ;

      System.out.println( "Request:\n" + msg );
       
      client.setRequestMessage( reqMsg );
      client.invoke();
      resMsg = client.getMessageContext().getResponseMessage();

      System.out.println( "Response:\n" + resMsg.getAsString() );
        return (String)resMsg.getAsString();
    }
View Full Code Here


class put {
    static void main(String[] args) throws Exception {
        Options opts = new Options(args);
        String action = opts.isValueSet('a');

        ServiceClient sc = new ServiceClient(opts.getURL());
        if (action != null) sc.set(HTTPTransport.ACTION, action);
 
        args = opts.getRemainingArgs();
        for (int i=0; i<args.length; i++) {
            FileInputStream stream = new FileInputStream(new File(args[i]));
            sc.setRequestMessage(new Message(stream));
   
            sc.invoke();
       
            MessageContext mc = sc.getMessageContext();
            System.out.println(mc.getResponseMessage().getAsString());
        }
    }
View Full Code Here

      System.err.println( "Usage: GetQuote <symbol>" );
      System.exit(1);
    }
   
    String   symbol = args[0] ;
    ServiceClient call = new ServiceClient();
    ServiceDescription sd = new ServiceDescription("stockQuotes", true);
    sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
    call.setServiceDescription(sd);
 
    call.set(Transport.USER, opts.getUser() );
    call.set(Transport.PASSWORD, opts.getPassword() );
    call.setTransport( new FileTransport() );
    call.setTimeout(10000);
 
    Float res = new Float(0.0F);
    res = (Float) call.invoke( "urn:xmltoday-delayed-quotes",
                               "getQuote",
                               new Object[] {symbol} );
 
    System.out.println( symbol + ": " + res );
View Full Code Here

        try {
            Options options = new Options(args);
           
            String endpointURL = options.getURL();
           
            ServiceClient client = new ServiceClient(endpointURL);
           
            client.invoke("LogTestService", "testMethod", new Object [] {});
        } catch (Exception e) {
            System.err.println(e.toString());
        }
    }
View Full Code Here

        int [] quantities = new int [] { 1, 4 };
       
        order.setItemCodes(items);
        order.setQuantities(quantities);
       
        ServiceClient client = new ServiceClient(options.getURL());
        client.addSerializer(Order.class, new QName("urn:BeanService", "Order"),
                             new org.apache.axis.encoding.BeanSerializer(Order.class));
       
        String result;
        try {
            result = (String)client.invoke("OrderProcessor",
                                           "processOrder",
                                           new Object[] { order });
        } catch (AxisFault fault) {
            result = "Error : " + fault.toString();
        }
View Full Code Here

    public void doTestStock() throws Exception {
        try {
            System.out.println("Testing TCP stock service...");
            String   symbol = "XXX"; // args[0] ;

            ServiceClient call   = new ServiceClient
                ( new TCPTransport("localhost", "8088") );
           
            // reconstruct URL
            ServiceDescription sd = new ServiceDescription("stockQuotes", true);
            sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
            call.setServiceDescription(sd);
           
            Float res = new Float(0.0F);
            //      for (int i=0; i<count; i++) {
            Object ret = call.invoke(
                "urn:xmltoday-delayed-quotes", "getQuote",
                new Object[] {symbol} );
            if (ret instanceof Float) {
                res = (Float) ret;
                // System.out.println( symbol + ": " + res );
View Full Code Here

  {
    try {
      ServiceDescription sd = new ServiceDescription("lookup", true );
      sd.addOutputParam("RequestForQuoteResult",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      ServiceClient call = new ServiceClient(new HTTPTransport());
      call.set(HTTPTransport.URL, registryURL);
      call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/LookupAsString");
      call.setServiceDescription(sd);
      RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
                                        "LookupAsString",
                                        new RPCParam[] {
                                          new RPCParam("ServiceType",
                                                       "Bid") } );
      String res = (String) call.invoke( body );
      if ( res == null ) return( null );
      StringTokenizer  lineParser = new StringTokenizer( res, "\n" );

      Vector services = new Vector();
      while ( lineParser.hasMoreTokens() ) {
View Full Code Here

                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_DOUBLE);
      ServiceClient call =
            new ServiceClient(new HTTPTransport
                                  (serverURL, "http://www.soapinterop.org/RequestForQuote"));
      call.setServiceDescription( sd );
      RPCElement body = new RPCElement( "http://www.soapinterop.org/Bid",
                                        "RequestForQuote",
                                        new RPCParam[] {
                                          new RPCParam( "ProductName",
                                                        "widget"),
                                          new RPCParam( "Quantity",
                                                        new Integer(10) ) } );
      Object r = call.invoke( body );
      if ( r instanceof Float ) r = ((Float)r).toString();
      if ( r instanceof String ) r = new Double((String) r);
      Double res = (Double) r ;
      return( res.doubleValue() );
    }
View Full Code Here

                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_STRING);
      ServiceClient call =
            new ServiceClient(new HTTPTransport
                                  (serverURL, "http://www.soapinterop.org/SimpleBuy"));
      RPCElement  body = new RPCElement( "http://www.soapinterop.org/Bid",
                                         "SimpleBuy",
                                         new RPCParam[] {
                                           new RPCParam("Address",
                                                        "123 Main St."),
                                           new RPCParam("ProductName",
                                                        "Widget"),
                                           new RPCParam("Quantity",
                                                        new Integer(quantity))});
      String res = (String) call.invoke( body );
      return( res );
    }
    catch( Exception e ) {
      e.printStackTrace();
      throw e ;
View Full Code Here

                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("Result",
                        SOAPTypeMappingRegistry.XSD_STRING);
      sd.addOutputParam("return",
                        SOAPTypeMappingRegistry.XSD_STRING);
      ServiceClient call = new ServiceClient(new HTTPTransport());
      call.set(HTTPTransport.URL, serverURL);
      call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Buy");


      // register the PurchaseOrder class
      QName poqn = new QName("http://www.soapinterop.org/Bid",
                             "PurchaseOrder");
      Class cls = PurchaseOrder.class;
      call.addSerializer(cls, poqn, new BeanSerializer(cls));
      call.addDeserializerFactory(poqn, cls, BeanSerializer.getFactory());

      // register the Address class
      QName aqn = new QName("http://www.soapinterop.org/Bid", "Address");
      cls = Address.class;
      call.addSerializer(cls, aqn, new BeanSerializer(cls));
      call.addDeserializerFactory(aqn, cls, BeanSerializer.getFactory());

      // register the LineItem class
      QName liqn = new QName("http://www.soapinterop.org/Bid", "LineItem");
      cls = LineItem.class;
      call.addSerializer(cls, liqn, new BeanSerializer(cls));
      call.addDeserializerFactory(liqn, cls, BeanSerializer.getFactory());

      LineItem[]     lineItems = new LineItem[numItems];
     
     
      for ( i = 0 ; i < numItems ; i++ )
        lineItems[i] = new LineItem("Widget"+i,quantity,new BigDecimal(price));

      PurchaseOrder  po = new PurchaseOrder( "PO1",
                                             new Date(),
                                             new Address("Mr Big",
                                                         "40 Wildwood Lane",
                                                         "Weston",
                                                         "CT",
                                                         "06883"),
                                             new Address("Mr Big's Dad",
                                                         "40 Wildwood Lane",
                                                         "Weston",
                                                         "CT",
                                                         "06883"),
                                             lineItems );

      RPCElement  body = new RPCElement( "http://www.soapinterop.org/Bid",
                                         "Buy",
                                         new RPCParam[]{
                                           new RPCParam("PO",
                                                        po)} );
      String res = (String) call.invoke( body );
      return( res );
    }
    catch( Exception e ) {
      e.printStackTrace();
      throw e ;
View Full Code Here

TOP

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

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.