Package org.apache.axis.client

Examples of org.apache.axis.client.ServiceClient


    }
  }

  public void unregister(String registryURL, String name) throws Exception {
    try {
      ServiceClient call = new ServiceClient
            (new HTTPTransport(registryURL, "http://www.soapinterop.org/Unregister"));
      RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
                                        "Unregister",
                                        new RPCParam[] {
                                          new RPCParam("ServiceName",
                                                       name) } );
      call.invoke( body );
    }
    catch( Exception e ) {
      e.printStackTrace();
      throw e ;
    }
View Full Code Here


    }
  }

  public Boolean ping(String serverURL) throws Exception {
    try {
      ServiceClient call = new ServiceClient(new HTTPTransport());
      call.set(HTTPTransport.URL, serverURL);
      call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Ping");
      call.invoke( "http://www.soapinterop.org/Bid", "Ping", null );
      return( new Boolean(true) );
    }
    catch( Exception e ) {
      e.printStackTrace();
      throw e ;
View Full Code Here

            else {
                log( "Processing file: " + args[i] );
                input = new FileInputStream( args[i] );
            }
           
            ServiceClient client = new ServiceClient(opts.getURL());
           
            /** Unfortunately, this is transport-specific.  However, no one
            * but the HTTP transport should pick this property up.
            */
            client.set(HTTPConstants.MC_HTTP_SOAPACTION, "AdminService");
           
            Message         inMsg      = new Message( input, true );
           
            client.setRequestMessage( inMsg );
           
            client.set( Transport.USER, opts.getUser() );
            client.set( Transport.PASSWORD, opts.getPassword() );

            String tName = opts.isValueSet( 't' );
            if ( tName != null && !tName.equals("") )
                client.setTransportName( tName );
           
            client.invoke();
           
            Message outMsg = client.getMessageContext().
                                                        getResponseMessage();
            if (outMsg == null) {
                log("Null response message!");
                return null;
            }
           
            client
              .getMessageContext()
               .setServiceDescription(new ServiceDescription("Admin", false));
           
            input.close();
            SOAPEnvelope envelope =
                                   (SOAPEnvelope) outMsg.getAsSOAPEnvelope();
            SOAPBodyElement body = envelope.getFirstBody();
            StringWriter writer = new StringWriter();
            client.addOption(AxisEngine.PROP_XML_DECL, new Boolean(false));
            SerializationContext ctx = new SerializationContext(writer,
                                                  client.getMessageContext());
            ctx.setPretty(true);
            body.output(ctx);
            sb.append(writer.toString());
            sb.append('\n');
        }
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

      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

      }

      String namespace = "urn:xmltoday-delayed-quotes";
      symbol = args[0] ;

      ServiceClient call = new ServiceClient(opts.getURL());
      call.setTransport(new TCPTransport());
      ServiceDescription sd = new ServiceDescription("stockQuotes", true);
      sd.addInputParam("symbol", SOAPTypeMappingRegistry.XSD_STRING);
      sd.setOutputType(SOAPTypeMappingRegistry.XSD_FLOAT);
      call.setServiceDescription(sd);
     
      // TESTING HACK BY ROBJ
      if (symbol.equals("XXX_noaction")) {
          symbol = "XXX";
          call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
      }

      call.set( Transport.USER, opts.getUser() );
      call.set( Transport.PASSWORD, 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(
          namespace, "getQuote", new Object[] {symbol} );
          if (ret instanceof String) {
              System.out.println("Received problem response from server: "+ret);
              throw new AxisFault("", (String)ret, null, null);
          }
View Full Code Here

       
        // 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
        ServiceClient client = new ServiceClient(msgContext.getAxisEngine().getClientEngine());
       
        // add TCP for proxy testing
        client.addTransportPackage("samples.transport");
        client.setTransportForProtocol("tcp", new TCPTransport());
       
        // NOW set the client's URL (since now the tcp handler exists)
        client.setURL(dest);
       
        client.setRequestMessage(msgContext.getRequestMessage());
       
        client.invoke();
       
        msgContext.setResponseMessage(client.getMessageContext().getResponseMessage());
       
        // return null so MsgProvider will not muck with our response
        return null;
    }
View Full Code Here

                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }
           
            ServiceClient client = new ServiceClient(endpointURL);
           
            String ret = (String)client.invoke("MyService", "serviceMethod",
                                               new Object [] { textToSend });
           
            System.out.println("You typed : " + ret);
        } catch (Exception e) {
            System.err.println(e.toString());
View Full Code Here

     */
    public static void main(String args[]) throws Exception {
        // set up the call object
        Options opts = new Options(args);
        Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
        call = new ServiceClient(opts.getURL());
        call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Bid");

        // register the PurchaseOrder class
        QName poqn = new QName("http://www.soapinterop.org/Bid",
                               "PurchaseOrder");
View Full Code Here

      }

      String namespace = "urn:xmltoday-delayed-quotes";
      symbol = args[0] ;

      ServiceClient call = new ServiceClient(opts.getURL());
      ServiceDescription sd = new ServiceDescription("stockQuotes", true);
      sd.addInputParam("symbol", SOAPTypeMappingRegistry.XSD_STRING);
      sd.setOutputType(SOAPTypeMappingRegistry.XSD_FLOAT);
      call.setServiceDescription(sd);
     
      // TESTING HACK BY ROBJ
      if (symbol.equals("XXX_noaction")) {
          symbol = "XXX";
          call.set(HTTPConstants.MC_HTTP_SOAPACTION, "");
      }

      call.set( Transport.USER, opts.getUser() );
      call.set( Transport.PASSWORD, 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(
          namespace, "getQuote", new Object[] {symbol} );
          if (ret instanceof String) {
              System.out.println("Received problem response from server: "+ret);
              throw new AxisFault("", (String)ret, null, null);
          }
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.