I’m having a problem sending a java.util.Date object from my C# client to my java webserver.
When I am calling a WebMethod with a Date WebParam it works. But if I am calling a WebMethod with a custom object that has a Date as WebParam it’s always null.
So, this works:
@WebMethod(operationName="thisWorks")
public void thisWorks(@WebParam(name="from")Date from)
{
System.out.println(from); //prints the value of the date
}
This doesn’t work:
class MyObj { java.util.Date getMyDate(); }
@WebMethod(operationName="thisDoesntWork")
public void thisDoesntWork(@WebParam(name="myObj")MyObj myObj)
{
System.out.println(myObj.getMyDate()); //prints null
}
Client:
ServiceClient client = new ServiceClient();
client.thisWorks(DateTime.Now);
myObj o = new myObj();
o.myDate = DateTime.Now;
client.thisDoesntWork(o);
The wsdl generates an extra field for the myDate: “bool myDateSpecified”. When I set this to true, it works. This is weird, cause when I would have an int field instead of date I also get a specified field for it, but now I dont have to set the specified field for it to work.