I am new to AXIS and was looking for* client side support classes* that will
enable easy *dynamic invocation* of WEB services.
At the beginning I found AXIS 1.4 and there I've found in the User's guide
an example which seemed to cover what I was looking for:

public class TestClient {
  public static void main(String [] args) {
    try {
      String endpoint ="http://ws.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"));

      String ret = (String) call.invoke( new Object[] { "Hello!" } );
      System.out.println("Sent 'Hello!', got '" + ret + "'");
    } catch (Exception e) {
       System.err.println(e.toString());

    }
  }
}



But then I've learned that there is new version Axis2 version 1.4.1 and in
the user's guide they directed the reader on *migration *path from older
Axis version to the new one.
I was surprise to see that the above (seemingly) simple coding style  was
replaced by kind of 'low level' coding style of Soap using* Axiom*framework:

public class EchoBlockingClient {
        private static EndpointReference targetEPR = new EndpointReference(

                        "http://127.0.0.1:8080/axis2/services/MyService";);

        public static void main(String[] args) {
                try {

                        OMFactory fac = OMAbstractFactory.getOMFactory();
                        OMNamespace ns =
fac.createOMNamespace("http://soapinterop.org/";, "ns1");

                        OMElement payload =
fac.createOMElement("echoString", ns);
                        payload.setText("Hello!");
                        Options options = new Options();

                        ServiceClient client = new ServiceClient();

                        options.setTo(targetEPR);
                        client.setOptions(options);
                        //Blocking invocation

                        OMElement result = client.sendReceive(payload);

                        System.out.println("Sent Hello, got : " +
result.toString());

                } catch (AxisFault axisFault) {

                        axisFault.printStackTrace();
                }


        }
}




And I wander why Axis2 V 1.4.1 eliminate the support to an invocation style
which centered on the signature (method name, arguments) of a service call
and instead prefer building Soap nodes?

I'll be much obliged if someone can tell me that whether Axis2 is suitable
for one who *does not care about building web services* but only in *consuming
them dynamically* (from Java based code) while the target services  will be
either Microsoft's ASMX or WCF based or anything else. If the answer is
affirmative, please let me know which set of classes are suitable to this
kind of mission.

The only assumptions I have in hand is that my client need to invoke various
web services upon request where for each web service I'm provided with it's
WSDL and a set of value parameters I (like operation name to invoke along
with its arguments) - Can I do it with AXIS2? If so, please let me know how.
- an example will be helpful here.

Thanks
/Avi

Reply via email to