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 sn...@apache.org on 2004/05/07 10:37:24 UTC

cvs commit: ws-fx/sandesha/interop/org/apache/sandesha/samples/interop Scenario_2_3_Client.java

snimalan    2004/05/07 01:37:24

  Added:       sandesha/interop/org/apache/sandesha/samples/interop
                        Scenario_2_3_Client.java
  Log:
  Sample Client for Scenario 2.3
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/Scenario_2_3_Client.java
  
  Index: Scenario_2_3_Client.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 javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  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;
  
  /**
   * Run client for
   * <a href="http://www-106.ibm.com/developerworks/offers/WS-Specworkshops/ws-rm200405.html">interop scenario 2.3</a>
   *
   * @author Aleksander Slominski
   * @author Amila Navarathna
   * @author Jaliya Ekanayaka
   * @author Sudar Nimalan
   */
  public class Scenario_2_3_Client {
  	public static void main(String[] args) {
  		System.out.println("Client started......");
  		try {
  
  			Service service = new Service();
  
  			Call call = (Call) service.createCall();
  			if (args.length == 0 || args[0].equals("")) {
  				throw new Exception("Error: pass Target End Point Address as a Parametter");
  			}
  
  			call.setTargetEndpointAddress(args[0]);
  			call.setOperationName(new QName("EchoStringService", "echoString"));
  			call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
  			call.addParameter("Sequence", XMLType.XSD_STRING, ParameterMode.IN);
  			call.setReturnType(XMLType.SOAP_STRING);
  
  			UUIDGen uuidGen = UUIDGenFactory.getUUIDGen();
  
  			call.setProperty(
  				Constants.CLIENT_RESPONSE_EXPECTED,
  				(new Boolean(true)));
  
  			String seq = uuidGen.nextUUID();
  			System.out.println(call.invoke(new Object[] { "Hello", seq }));
  			System.out.println(call.invoke(new Object[] { "World", seq }));
  			call.setProperty(
  				Constants.CLIENT_LAST_MESSAGE,
  				(new Boolean(true)));
  			//call.setLastMessage(true);
  			System.out.println(call.invoke(new Object[] { "Bye", seq }));
  
  		} catch (Exception e) {
  			//System.err.println(e.toString());
  			e.printStackTrace();
  		}
  	}
  }