uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

4.3.3 Creating a Web Service Implementation Class

Add Web Service processing to a skeleton class to create a Web Service Implementation Class. This subsection describes how to add the processing for returning the contents of the received request message along with the date information as the response message.

The following is an example for creating a Web Service Implementation Class:

package com.example.sample;
 
import java.util.Calendar;
import javax.jws.WebService;
 
 
@WebService(endpointInterface = "com.example.sample.TestJaxWs", targetNamespace = "http://example.com/sample", serviceName = "TestJaxWsService", portName = "testJaxWs")
public class TestJaxWsImpl {
 
public String jaxWsTest1(String information, int count)
 throws UserDefinedException
 {
 Calendar today = Calendar.getInstance();
 StringBuffer result = new StringBuffer( 256 );
 result.append( "We've got your #" );
 result.append( new Integer( count ) );
 result.append( " message \"" );
 result.append( information );
 result.append( "\"! It's " );
 result.append( String.format( "%04d.%02d.%02d %02d:%02d:%02d", new Object[]{
  new Integer( today.get( Calendar.YEAR ) ),
  new Integer( today.get( Calendar.MONTH ) + 1 ),
  new Integer( today.get( Calendar.DAY_OF_MONTH ) ),
  new Integer( today.get( Calendar.HOUR_OF_DAY ) ),
  new Integer( today.get( Calendar.MINUTE ) ),
  new Integer( today.get( Calendar.SECOND ) ) } ) );
 result.append( " now. See ya!" );
 
 return result.toString();
 }
}

The locations in italics are the implementation added for skeletons.