views:

102

answers:

1

Hi, I've configured a simple CXF endpoit with spring wich expose a simple object with a java.util.Date property. once remotely invoked with a .NET client the date property is always null.

endopit:

<jaxws:endpoint id="simpleService" implementor="cxf.base.SimpleServiceImpl" address="/SimpleService" />

.NET call:

    SimpleServiceClient client = new SimpleServiceClient();
    simpleObject simpleObject = new simpleObject();
    simpleObject.date = new DateTime(2010, 1, 1);
    simpleObject.name = "Simple Object";

    txtResult.Text = client.toString(simpleObject);

where toString is the exposde webservice method.

Any idea what I am missing here ?

+1  A: 

I guess it's in the marshall phase on the server-side that's has the bug. If you're not sure, then do some logging on the server-side. Also, a tcp/ip monitor can show the SOAP elements transferred. Eclipse for example has an excellent tcp/ip monitor view.

If it's a marshall bug, and you marshall with JAXB, then you must convert the java.util.Date value to a javax.xml.datatype.XMLGregorianCalendar value.

This can be done with the javax.xml.datatype.DatatypeFactory class.

Be sure to use the overloaded newXMLGregorianCalendar() method that matches your date element.

A page with good information about the different date and time XSD elements: http://www.w3schools.com/Schema/schema_dtypes_date.asp

Espen