Echo sample

This sample demonstrates the Mobile Web Services capabilities.

Time required: 2 minutes

You can use this sample only on the desktop runtime.

This sample contains three projects: com.ibm.rcp.samples.ws.echo.client, com.ibm.rcp.samples.ws.echo.marshal, and com.ibm.rcp.samples.ws.echo.server.

Key concepts demonstrated in this sample are as follows:
  • Expose an OSGi service as a Web Service
  • Use custom serialization and deserialization (also referred to as custom marshalling)
  • Access a Web Service using a dynamic client

Setup instructions

Before you can run the sample, you must first import the sample into your workspace and launch the test runtime.
  1. To import the sample:
    1. Select File > Import.
    2. From the Import Wizard, select General and then select Existing Projects into Workspace. Click Next.
    3. Select the Archive file radio button.
    4. Enter the name of the sample jar file, echo.jar, or browse to the com.ibm.rcp.tools.samplegallery plug-in directory, then the archive directory, and select the archive file.
    5. The dialog shows the projects present in the archive jar file. Select Finish to install the projects into your workspace.
  2. To configure and run the sample:
    1. Select Run > Run from the main menu.
    2. Select Client Services and click New.
    3. Type a unique name for your configuration, such as Echo.
    4. Select the Plug-ins tab and verify that the com.ibm.rcp.samples.ws.echo.server, com.ibm.rcp.samples.ws.echo.marshal, and com.ibm.rcp.samples.ws.echo.client plug-ins are selected.
    5. Select the Arguments tab and verify that –console is in the Program Arguments field.
    6. Click Apply and then Run.
  3. To start the sample, enter a start bundle_name command for each plug-in in the Console view. Bundle names are as follows:
    • com.ibm.rcp.samples.ws.echo.marshal – Starts the marshal plug-in to register the custom serializer implementations.
    • com.ibm.rcp.samples.ws.echo.server – Starts the Web service provider bundle.
    • com.ibm.rcp.samples.ws.echo.client – Starts the Web service client bundle.
    Attention: You must start these bundles in the order shown and stop bundles in the reverse order. To stop a bundle, use the stop bundle_name command.
Output is similar to the following:
osgi> start com.ibm.rcp.samples.ws.echo.marshal

osgi> start com.ibm.rcp.samples.ws.echo.server

osgi> start com.ibm.rcp.samples.ws.echo.client

osgi> refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={ws.location=http://localhost:3760/ws/pid/echoSvc, serv
ice.id=107}
SERVER_SIDE=null
Bundle ws:http://localhost:3760/ws/pid/echoSvc?wsdl says:
{req1=Counter = 1}
{req1=Counter = 1}@java.util.GregorianCalendar[time=1150078860000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zo
ne=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,
lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,st
artMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endD
ayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2006,MONTH=5,WEEK_OF_YEA
R=24,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR=162,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,
MINUTE=21,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=3600000]
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={service.pid=echoSvc, SERVER_SIDE=true, service.id=106}
SERVER_SIDE=true
This is the server side bundle, skipping...



------------
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={ws.location=http://localhost:3760/ws/pid/echoSvc, service.id
=107}
SERVER_SIDE=null
Bundle ws:http://localhost:3760/ws/pid/echoSvc?wsdl says:
{req2=Counter = 2, req1=Counter = 1}
{req2=Counter = 2, req1=Counter = 1}@java.util.GregorianCalendar[time=1150078860000,areFieldsSet=true,areAllFieldsSet=tr
ue,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=tru
e,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=t
rue,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMont
h=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2006,M
ONTH=5,WEEK_OF_YEAR=24,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR=162,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR
=9,HOUR_OF_DAY=21,MINUTE=21,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=3600000]
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={service.pid=echoSvc, SERVER_SIDE=true, service.id=106}
SERVER_SIDE=true
This is the server side bundle, skipping...



------------
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={ws.location=http://localhost:3760/ws/pid/echoSvc, service.id
=107}
SERVER_SIDE=null
Bundle ws:http://localhost:3760/ws/pid/echoSvc?wsdl says:
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1}
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1}@java.util.GregorianCalendar[time=1150078860000,areFieldsSet=true,
areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=36000
00,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=360
0000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0
,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1
,ERA=1,YEAR=2006,MONTH=5,WEEK_OF_YEAR=24,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR=162,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MO
NTH=2,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,MINUTE=21,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=3600000]
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={service.pid=echoSvc, SERVER_SIDE=true, service.id=106}
SERVER_SIDE=true
This is the server side bundle, skipping...



------------
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={ws.location=http://localhost:3760/ws/pid/echoSvc, service.id
=107}
SERVER_SIDE=null
Bundle ws:http://localhost:3760/ws/pid/echoSvc?wsdl says:
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1, req4=Counter = 4}
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1, req4=Counter = 4}@java.util.GregorianCalendar[time=1150078860000,
areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-2160000
0,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600
000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=72000
00,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minima
lDaysInFirstWeek=1,ERA=1,YEAR=2006,MONTH=5,WEEK_OF_YEAR=24,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR=162,DAY_OF_WEEK=1
,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,MINUTE=21,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21600000,DST_OFFSET=
3600000]
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={service.pid=echoSvc, SERVER_SIDE=true, service.id=106}
SERVER_SIDE=true
This is the server side bundle, skipping...



------------
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={ws.location=http://localhost:3760/ws/pid/echoSvc, service.id
=107}
SERVER_SIDE=null
Bundle ws:http://localhost:3760/ws/pid/echoSvc?wsdl says:
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1, req5=Counter = 5, req4=Counter = 4}
{req3=Counter = 3, req2=Counter = 2, req1=Counter = 1, req5=Counter = 5, req4=Counter = 4}@java.util.GregorianCalendar[t
ime=1150078860000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicag
o",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chi
cago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek
=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],first
DayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2006,MONTH=5,WEEK_OF_YEAR=24,WEEK_OF_MONTH=3,DAY_OF_MONTH=11,DAY_OF_YEAR
=162,DAY_OF_WEEK=1,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,MINUTE=21,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-21
600000,DST_OFFSET=3600000]
refs[i]: {com.ibm.rcp.samples.ws.echo.service.EchoService}={service.pid=echoSvc, SERVER_SIDE=true, service.id=106}
SERVER_SIDE=true
This is the server side bundle, skipping...



------------


osgi> stop com.ibm.rcp.samples.ws.echo.client

osgi> stop com.ibm.rcp.samples.ws.echo.server

osgi> stop com.ibm.rcp.samples.ws.echo.marshal


Library | Support | Terms of use |

Last updated: Wednesday, October 18, 2006
(C) Copyright IBM Corporation 2004, 2006. All Rights Reserved.
This information center is built on Eclipse. (http://www.eclipse.org)