jaliya 2005/02/28 02:52:14
Added: sandesha/interop/org/apache/sandesha/samples/interop
AsyncPingClient.java EchoClient.java
RMInteropService.java RMInteropServiceDeploy.wsdd
SyncPingClient.java
Removed: sandesha/interop/org/apache/sandesha/samples/interop
ApplicationServiceDeploy.wsdd ClientDeploy.wsdd
EchoStringService.java PingService.java
Scenario_1_1_Client.java Scenario_2_1_Client.java
Scenario_2_2_Client.java Scenario_2_3_Client.java
Log:
Removed the old inter-op samples, these are now obsalete as per the new
WS-ReliableMessaging Specification. Samples are added for the New RM Scenarios
Revision Changes Path
1.1
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/AsyncPingClient.java
Index: AsyncPingClient.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
under
* the License.
*
*/
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 AsyncPingClient {
private static String targetURL =
"http://127.0.0.1:9080/axis/services/RMInteropService?wsdl";
public static void main(String[] args) {
System.out.println("Client started...... Asynchronous ");
try {
RMInitiator.initClient(false);
Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty("sync", new Boolean(false));
call.setProperty("action", "sandesha:ping");
//These two are additional
//call.setProperty("from","http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous");
//call.setProperty("replyTo","http://10.10.0.4:8080/axis/services/MyService");
//http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("RMInteropService", "ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty("msgNumber", new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty("msgNumber", new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty("msgNumber", new Long(3));
call.setProperty(Constants.LAST_MSG, 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/EchoClient.java
Index: EchoClient.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
under
* the License.
*
*/
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 EchoClient {
private static String targetURL =
"http://127.0.0.1:9070/axis/services/RMInteropService?wsdl";
public static void main(String[] args) {
System.out.println("EchoClient Started ........");
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();
String str = "ABCDEF1234";
Service service = new Service();
Call call = (Call) service.createCall();
//To obtain the
call.setProperty("sync", new Boolean(false));
call.setProperty("action", "sandesha:echo");
//These two are additional
//call.setProperty("from","http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous");
call.setProperty("from","http://localhost:8070/axis/services/RMService");
//call.setProperty("replyTo","http://10.10.0.4:8080/axis/services/MyService");
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("RMInteropService",
"echoString"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setProperty("msgNumber", 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("msgNumber", 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("msgNumber", new Long(3));
call.setProperty(Constants.LAST_MSG, 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/RMInteropService.java
Index: RMInteropService.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
under
* the License.
*
*/
package org.apache.sandesha.samples.interop;
import java.util.HashMap;
import java.util.Map;
public class RMInteropService {
private static Map sequences = new HashMap();
public String echoString(String text, String sequence) {
if (sequences.get(sequence) != null) {
text = (String) sequences.get(sequence) + text;
sequences.put(sequence, new String(text));
} else {
sequences.put(sequence, (new String(text)));
}
System.out.println("ECHO-STRING SERVICE " + text);
return text;
}
public void ping(String text) {
System.out.println("PING-STRING SERVICE " + text);
}
}
1.1
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/RMInteropServiceDeploy.wsdd
Index: RMInteropServiceDeploy.wsdd
===================================================================
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="RMInteropService" provider="Handler">
<requestFlow>
<handler
type="java:org.apache.sandesha.ws.rm.handlers.RMServerRequestHandler"></handler>
<handler
type="java:org.apache.axis.message.addressing.handler.AddressingHandler"></handler>
</requestFlow>
<parameter name="handlerClass"
value="org.apache.sandesha.ws.rm.providers.RMProvider"/>
<parameter name="className"
value="org.apache.sandesha.samples.interop.RMInteropService"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="scope" value="request"/>
</service>
</deployment>
1.1
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/SyncPingClient.java
Index: SyncPingClient.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
under
* the License.
*
*/
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 SyncPingClient {
private static String targetURL =
"http://127.0.0.1:9080/axis/services/RMInteropService?wsdl";
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("sync", new Boolean(true));
call.setProperty("action", "sandesha:ping");
//These two are additional
//call.setProperty("from","http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous");
//call.setProperty("replyTo","http://10.10.0.4:8080/axis/services/MyService");
//http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous
call.setTargetEndpointAddress(targetURL);
call.setOperationName(new QName("RMInteropService", "ping"));
call.setTransport(new RMTransport(targetURL, ""));
call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
//First Message
call.setProperty("msgNumber", new Long(1));
call.invoke(new Object[]{"Ping Message Number One"});
//Second Message
call.setProperty("msgNumber", new Long(2));
call.invoke(new Object[]{"Ping Message Number Two"});
//Third Message
call.setProperty("msgNumber", new Long(3));
call.setProperty(Constants.LAST_MSG, 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();
}
}
}