You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ja...@apache.org on 2005/05/09 14:57:11 UTC
cvs commit: ws-fx/sandesha/interop/org/apache/sandesha/samples/interop IBMAsyncPing.java IBMEcho.java IBMSyncPing.java MicrosoftAsyncPing.java MicrosoftSyncPing.java SystinetAsyncPing.java SystinetSyncPing.java
jaliya 2005/05/09 05:57:11
Added: sandesha/interop/org/apache/sandesha/samples/interop
IBMAsyncPing.java IBMEcho.java IBMSyncPing.java
MicrosoftAsyncPing.java MicrosoftSyncPing.java
SystinetAsyncPing.java SystinetSyncPing.java
Log:
New interop clients
Revision Changes Path
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/IBMAsyncPing.java
Index: IBMAsyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class IBMAsyncPing {
private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
//client side.
public static void main(String[] args) {
System.out.println("Client started...... Asynchronous Ping - IBM");
try {
RMInitiator.initClient(false);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(false));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
call.setProperty(Constants.ClientProperties.ACKS_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FAULT_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FROM, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("http://tempuri.org/", "Ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); //For last message.
call.invoke(new Object[]{"Ping Message Number Three"});
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/IBMEcho.java
Index: IBMEcho.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.components.uuid.UUIDGen;
import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.axis.encoding.XMLType;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
/**
* Created by IntelliJ IDEA.
* User: Jaliya
* Date: Apr 21, 2005
* Time: 5:09:27 PM
* To change this template use File | Settings | File Templates.
*/
public class IBMEcho {
private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
//client side.
public static void main(String[] args) {
System.out.println("Client started...... Asynchronous EchoString - IBM");
try {
//A separate listner will be started if the value of the input parameter for the mehthod
// initClient is "false". If the service is of type request/response the parameter value shoule be "false"
RMInitiator.initClient(false);
UUIDGen uuidGen = UUIDGenFactory.getUUIDGen(); //Can use this for continuous testing.
String str = uuidGen.nextUUID();
Service service = new Service();
Call call = (Call) service.createCall();
//To obtain the
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(false));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:echoString");
call.setProperty(Constants.ClientProperties.TO, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
call.setProperty(Constants.ClientProperties.ACKS_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FAULT_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FROM, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.REPLY_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("http://tempuri.org/", "echoString"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("Sequence", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
String ret = (String) call.invoke(new Object[]{"Sandesha Echo 1", str});
System.out.println("The Response for First Messsage is :" + ret);
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
ret = (String) call.invoke(new Object[]{"Sandesha Echo 2", str});
System.out.println("The Response for Second Messsage is :" + ret);
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); //For last message.
ret = (String) call.invoke(new Object[]{"Sandesha Echo 3", str});
System.out.println("The Response for Third Messsage is :" + ret);
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/IBMSyncPing.java
Index: IBMSyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class IBMSyncPing {
private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
public static void main(String[] args) {
System.out.println("Client started...... Synchronous Ping - IBM");
try {
RMInitiator.initClient(true);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(true));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
call.setProperty(Constants.ClientProperties.ACKS_TO, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("http://tempuri.org/", "Ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); //For last message.
call.invoke(new Object[]{"Ping Message Number Three"});
RMInitiator.stopClient();
} catch (Exception e) {
//System.err.println(e.toString());
e.printStackTrace();
}
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/MicrosoftAsyncPing.java
Index: MicrosoftAsyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.Message;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
public class MicrosoftAsyncPing {
private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
private static String targetURL = "http://127.0.0.1:8080/SecureReliableMessaging/ReliableOneWayDual.svc";
public static void main(String[] args) {
System.out.println("Client started...... Asynchronous - Microsoft");
try {
RMInitiator.initClient(false);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(false));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://131.107.153.195/SecureReliableMessaging/ReliableOneWayDual.svc");
call.setProperty(Constants.ClientProperties.FROM, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.ACKS_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FAULT_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
call.setProperty(Constants.ClientProperties.REPLY_TO, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
// call.setProperty(Constants.ClientProperties.FAULT_TO,Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setTargetEndpointAddress(targetURL);
call.setOperationName("Ping");
call.setTransport(new RMTransport(targetURL, ""));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Message(getSOAPEnvelope(1)));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Message(getSOAPEnvelope(2)));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true));
call.invoke(new Message(getSOAPEnvelope(3)));
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
private static String getSOAPEnvelope(int i) {
return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\n" +
" <soapenv:Header>\n" +
" </soapenv:Header>\n" +
" <soapenv:Body>\n" +
" <Ping xmlns=\"http://tempuri.org/\">\n" +
" <Text>Ping Message Number " + i + "</Text>\n" +
" </Ping>\n" +
" </soapenv:Body></soapenv:Envelope>";
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/MicrosoftSyncPing.java
Index: MicrosoftSyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.Message;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
public class MicrosoftSyncPing {
private static String targetURL = "http://127.0.0.1:8080/SecureReliableMessaging/ReliableOneWay.svc";
public static void main(String[] args) {
System.out.println("Client started...... Synchronous - Microsoft ");
try {
RMInitiator.initClient(true);
Service service = new Service();
Call call = (Call) service.createCall();
//This is only bacause we need to send ReplyTo in all the messages for the Microsoft endpoint.
//If the invocation is sync then this property should be "true" however due to this bug in Microsoft
//Have to make it "false" to send ReplyTo.
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(false));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://131.107.153.195/SecureReliableMessaging/ReliableOneWay.svc");
call.setProperty(Constants.ClientProperties.FROM, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setProperty(Constants.ClientProperties.ACKS_TO,Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setProperty(Constants.ClientProperties.FAULT_TO, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setProperty(Constants.ClientProperties.REPLY_TO, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setTargetEndpointAddress(targetURL);
call.setOperationName("Ping");
call.setTransport(new RMTransport(targetURL, ""));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Message(getSOAPEnvelope(1)));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Message(getSOAPEnvelope(2)));
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true));
call.invoke(new Message(getSOAPEnvelope(3)));
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
private static String getSOAPEnvelope(int i) {
return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\n" +
" <soapenv:Header>\n" +
" </soapenv:Header>\n" +
" <soapenv:Body>\n" +
" <Ping xmlns=\"http://tempuri.org/\">\n" +
" <Text>Ping Message Number " + i + "</Text>\n" +
" </Ping>\n" +
" </soapenv:Body></soapenv:Envelope>";
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/SystinetAsyncPing.java
Index: SystinetAsyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class SystinetAsyncPing {
private static String targetURL = "http://127.0.0.1:6064/Service";
private static String sourceHost="192.248.18.51"; //Change this to your public IP address
private static String sourcePort="9070"; //Change this according to the listening port of the TCPMonitor in the
//client side.
public static void main(String[] args) {
System.out.println("Client started...... Synchronous ");
try {
RMInitiator.initClient(false);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(false));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://soap.systinet.net:6064/Service");
//We need to specify these since, we need to pass all the messages thorugh TCPMonitor. Else
//it will pick up the source host as the machine's IP and the source port as 9090 (default)
call.setProperty(Constants.ClientProperties.ACKS_TO, "http://"+sourceHost+":"+sourcePort+"/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FAULT_TO,"http://"+sourceHost+":"+sourcePort+"/axis/services/RMService");
call.setProperty(Constants.ClientProperties.FROM,"http://"+sourceHost+":"+sourcePort+"/axis/services/RMService");
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("urn:wsrm:Ping", "Ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); //For last message.
call.invoke(new Object[]{"Ping Message Number Three"});
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
}
1.1 ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/SystinetSyncPing.java
Index: SystinetSyncPing.java
===================================================================
package org.apache.sandesha.samples.interop;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.sandesha.Constants;
import org.apache.sandesha.RMInitiator;
import org.apache.sandesha.RMTransport;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class SystinetSyncPing {
private static String targetURL = "http://127.0.0.1:6064/Service";
public static void main(String[] args) {
System.out.println("Client started...... Synchronous ");
try {
RMInitiator.initClient(true);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Constants.ClientProperties.SYNC, new Boolean(true));
call.setProperty(Constants.ClientProperties.ACTION, "urn:wsrm:Ping");
call.setProperty(Constants.ClientProperties.TO, "http://soap.systinet.net:6064/Service");
call.setProperty(Constants.ClientProperties.ACKS_TO, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("urn:wsrm:Ping", "Ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(3));
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); //For last message.
call.invoke(new Object[]{"Ping Message Number Three"});
RMInitiator.stopClient();
} catch (Exception e) {
e.printStackTrace();
}
}
}