How to send Null Date to a Web service method

Hi,

how can I send a null Date to a method of a web service which requires a Date type input

ex..

    <method xmlns="http://....">
      <from>dateTime</from>
      <to>dateTime</to>
      <destinationCode>string</destinationCode>
    </method>

(from the method description..."to omit a parameter set it as nil; - if the 'to' date is nil, the system returns all objects that are available in date 'from'...")

Thanks,
Luigi


Answer this question

How to send Null Date to a Web service method

  • Sohandy

    Are you using ASP.Net Web Services v2.0   If you are using v2.0 and the schema for the DateTime is nillable youshould be able to pass null for the DateTime.

    Daniel Roth



  • James Howey

    Maybe I wasn't clear enough. I know I can pass a null value, the problem is How...

    On the client side I have ASP.NET 2.0 Pages which access to a Generic Web Service exposing the method which I write in my first post.

    Imagine that from ASP.NET 2.0  page  I call the method:

    Dim myObject as Obect
    Dim fromDate,toDate as Date
    Dim destinationCode as String

    fromDate = Date.Today
    toDate = Nothing
    destinationCode = "23"

    myObject = somemethod(fromDate, toDate, destinationCode)

    ...........

    Obviously this return ar error as the somemethod is especting a Date type in the place of the variable toDate.

    Thanks for helping me.
    Luigi

     

     

     

     

     

     


  • How to send Null Date to a Web service method