Browse DevX
Sign up for e-mail newsletters from DevX


Extend Your J2EE Applications into Web Services : Page 4

Web services are here. It's time to extend your J2EE applications. Apache Axis allows you to Web-service enable existing J2EE applications without touching your back-end business logic.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Invoking Web Services
Unlike invoking EJBs, invoking Web services is simple and straightforward. "CallWS.jsp" has the code to invoke them:

Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName("http://localhost/", "reverse") ); ws_return_text = (String) call.invoke( new Object[] { enteredText } );

The Service class is the starting point for accessing SOAP Web services. The Call class actually invokes the Web service. It provides a number of setter/getter methods. QName represents XML-qualified names. The value space of QName is a set of tuples (namespace name, localpart). The localpart provides the local part of the qualified name.

The Web Service operation to be invoked is passed as a parameter to the invoke method of the Call object. If an array of SOAPBodyElements is not passed, the method defaults to RPC.

You're Done
This tutorial demonstrated how Axis allows you to Web-service enable existing J2EE applications—without touching your back-end business logic.

Raghu Donepudi, an independent contractor, currently is a technical manager for a federal government agency. He has a master's degree in Computer Science from Lamar University in Texas. He is a Sun-certified Java developer and the author of many software design techniques.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date