uCosminexus Application Server, Web Service Development Guide
Add the Web Service processing to the skeleton class to create a Web Service Implementation Class. Add the process to return the contents of the received request message as the response message along with the date information.
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 parts in Italics indicate the implementation added in the skeleton.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.