//-------------------------------------------------------------- // The following is an example written in Java using Apache Axis // to access the Echo Service. //-------------------------------------------------------------- package bevocal.platform.services.echo.client; import org.apache.axis.AxisFault; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.utils.Options; import javax.xml.rpc.ParameterMode; import javax.xml.namespace.QName; import org.apache.axis.message.SOAPHeaderElement; import org.apache.axis.message.PrefixedQName; //---------------------------------------------------------- // Sample client code that uses axis to invoke soap service: //---------------------------------------------------------- public class EchoClient { final static String serviceName = "EchoService"; final static String serviceVersion = "_v1"; final static String serviceNameAndVersion = serviceName + serviceVersion; final static String portName = "EchoService"; public static void main(String [] args) throws Exception { String endPoint = "https://cafe.services.bevocal.com/" + serviceName + "/services/" + serviceNameAndVersion; System.out.println("Using endpoint: " + endPoint); Service service = new Service(); Call call = (Call) service.createCall(); //-------------------------------------- // Setup header for security purpose: //-------------------------------------- SOAPHeaderElement header = new SOAPHeaderElement( bevocal.platform.services.core.HeaderConstants.DEFAULT_HEADER_NAMESPACE, bevocal.platform.services.core.HeaderConstants.PLATFORM_SERVICES_SESSION_ID, "some_dummy_session"); call.addHeader(header); try { //--------------------------------------- // Invoke the service & display result: //--------------------------------------- call.setTargetEndpointAddress(new java.net.URL(endPoint)); call.setOperationName( new QName(portName, "echo") ); String input = "Please echo this."; String ret = (String) call.invoke( new Object[] { input } ); System.out.println("Return : " + ret ); } catch (Exception e) { e.printStackTrace(); } } }