axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rusda, Sabri" <Sabri.Ru...@wincor-nixdorf.com>
Subject RE: [AXIS2] - Serialize/Deserialize java.util.Date
Date Mon, 11 Sep 2006 03:51:18 GMT
Hi Robert,

Here is the code :
---- service ---
package sample.axis;

import java.util.Date;
import java.util.Calendar;

public class HelloWorld {
    public void echoDate(Date date) throws Exception {
	System.out.println("date : "+date);
    }
    public void echoCalendar(Calendar cal) throws Exception {
	System.out.println("Calendar : "+cal);
    }
}
---- service.xml ---
<service name="HelloService">
    <description>
        This service is to get the running HelloWorld
    </description>
    <parameter name="ServiceClass"
locked="false">sample.axis.HelloWorld</parameter>
    <operation name="echoDate">
       	<messageReceiver
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
    </operation>
    <operation name="echoCalendar">
       	<messageReceiver
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
    </operation>
</service>
---- client ---

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.rpc.client.RPCServiceClient;

public class ServiceClientVoid {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		echoDate();
	}
	private static void echoDate() {
		try {
			String opName = "echoDate";
			EndpointReference targetEPR = new
EndpointReference("http://localhost:8080/axis2/services/HelloService");
			QName operationName = new
QName("http://axis.sample/xsd", opName);

			Options options = new Options();
			options.setTo(targetEPR);
	
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

			ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(nul
l, null);

			RPCServiceClient sender = new
RPCServiceClient(configContext, null);
			sender.setOptions(options);
			ArrayList params = new ArrayList();
	        Date date = Calendar.getInstance().getTime();
	        params.add(date);
  		  sender.invokeBlocking(operationName,
params.toArray());
		} catch (AxisFault e) {
			e.printStackTrace();
		}
	}
}

Looking forward for your help.. 

Regards,
srusda

-----Original Message-----
From: robert lazarski [mailto:robertlazarski@gmail.com] 
Sent: Thursday, September 07, 2006 1:15 AM
To: axis-user@ws.apache.org
Subject: Re: [AXIS2] - Serialize/Deserialize java.util.Date

Show us your code and a stacktrace, and maybe we can help.
java,util.Date is part of our junit tests, which are part of the src
distro:

http://people.apache.org/dist/axis2/nightly/axis2-std-SNAPSHOT-src.zip

modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java

Take a look at testCalender() .

HTH,
Robert

On 9/6/06, Rusda, Sabri <Sabri.Rusda@wincor-nixdorf.com> wrote:
> Hi there,
>
> Can I serialize/deserialize java.util.Date in Axis2 ? or it's the
> limitation of Axis2 ?
> I always get error when I call the operation with parameter
> java.util.Date. any help are wellcome.
>
>
> Regards,
> srusda
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message