You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Andrews Scanavarro <a...@gsigma.ufsc.br> on 2006/08/30 20:19:23 UTC

Dynamic Binding / Stubless Invocation

Hello all!
I have two Web Services (on Axis) that do the same thing (a sum for example), running on different machines on the network. I also have a third machine with a .NET client (or a BEA Weblogic/Java client) that want to invoke the service (assuming that it knows how to find best one, for its particular needs, this is out of the context).
 
My question is, when I've already found the one to invoke, I (me, person) will need to create the stubs for this service (tightly binding is the name?) ??? What about the dynamics (and independency/machine processable) of the Web Services, I mean, I would like to do it automatically, without human intervention (in the generation of the stubs for the communication).
 
Thanks in advance!

Andrews


Re: Dynamic Binding / Stubless Invocation

Posted by Martin Gainty <mg...@hotmail.com>.
Assuming the port is the same(which it will be unless you specifically reconfig Tomcat otherwise)
You would need to identify the machine name via setTargetEndpointAddress for the call object as in this example-

        Service service = new Service();
        try
        {
         Call call = (Call) service.createCall();
//endPoint is passed in from client
         call.setTargetEndpointAddress(new java.net.URL(endPoint));

//OperationName
         call.setOperationName(method);

         String[] tokens = word.split(",");

         list = java.util.Arrays.asList(tokens);

         //iterate thru all tokens ..
         if(call.isParameterAndReturnSpecRequired(new QName(method)))
         {
          for (int x=0; x<list.size(); x++)
          {
                tokens = list.get(x).toString().split("=");

                String Fieldname       = new String(tokens[0]);
                String Fieldname_value = new String(tokens[1]);

//                determineFieldname(call, Fieldname,Fieldname_value);
              if(Fieldname == "out_ID")
              {
                 out_ID=Fieldname_value;
                 call.addParameter("out_ID", org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
            }
            if(Fieldname == "out_NAME")
            {
             out_NAME = Fieldname_value;
             call.addParameter("out_NAME", org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
           }
            if(Fieldname == "the_network_active")
            {
             the_network_active=Fieldname_value;
             call.addParameter("the_network_active", org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
             }
            if(Fieldname == "the_network_id")
            {
             the_network_id=Fieldname_value;
             call.addParameter("network_id", org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
             }
             if(Fieldname == "the_network_name")
             {
              the_network_name = Fieldname_value;
              call.addParameter("the_network_name", org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
            }
      } //end for
     } //end isParameterAndReturnSpecRequired(QName operationName) returns true

    Object parameters[] = new Object[]{out_ID,out_NAME,the_network_active,the_network_id,the_network_name};

    for (int x=0; x<list.size(); x++)
    {
           System.out.println("parameter:"+x+" is = "+parameters[x].toString());
     }

    results = call.invoke(parameters);

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



  ----- Original Message ----- 
  From: Andrews Scanavarro 
  To: axis-user@ws.apache.org 
  Sent: Wednesday, August 30, 2006 2:19 PM
  Subject: Dynamic Binding / Stubless Invocation


  Hello all!
  I have two Web Services (on Axis) that do the same thing (a sum for example), running on different machines on the network. I also have a third machine with a .NET client (or a BEA Weblogic/Java client) that want to invoke the service (assuming that it knows how to find best one, for its particular needs, this is out of the context).
   
  My question is, when I've already found the one to invoke, I (me, person) will need to create the stubs for this service (tightly binding is the name?) ??? What about the dynamics (and independency/machine processable) of the Web Services, I mean, I would like to do it automatically, without human intervention (in the generation of the stubs for the communication).
   
  Thanks in advance!

  Andrews