Re: DateTime WebService Discrepancy.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 03/29/04


Date: Mon, 29 Mar 2004 13:59:05 -0500

Hi fhunter:

Since your web service isn't doing anything at all other than making a
string representation, I doubt it's the problem. If you put a break point
right before the call to GetDateTime or add a MessageBox, is it correct to
say that the time being passed in is correct?

ie
MessageBox.Show(syncDate.ToString()); //Will show 3/29/2004 5:52:58 PM
string test = mServ.GetDateTime( syncDate );
MessageBox.Show(test); //Will Show 3/29/2004 6:52:58 PM

If the datetime sent is the first value, the return value will be one hour
later? If so, then why not just use string test = syncDate.ToString(); //
.ToShortDateString(), ToShortTimeString() etc
I can't tell if you verified the input b/c of the 'supposedly' but if the
time you are sending as a parameter is correct, i'd just use ToString()
locally and cut out the call to the web service. This will be easier to
code, more straightforward, more efficient and won't be dependent on the web
service working. If you haven't verified the parameter you are passing
verify it first with the messagebox but use MessageBox.Show( test,
syncDate.ToString()); and see what the results are. I've copied the web
method and fired it from a CF app I just whipped up and it's working fine so
the most likely culprit is that the parameter you are passing isn't what you
expect. From this code, they should be the same.

Anyway, add the lines of code I mentioned and post the results if you
would. That will help confirm what the input and output are. However, I
don't think you need to web service at all and it's a lot easier to just do
without it.

Let me know...

Bill

"fhunter" <anonymous@discussions.microsoft.com> wrote in message
news:B70DC4F3-CE29-41B6-A661-79B7F1373C8B@microsoft.com...
> Can someone shed some light on this one.
> I have a WebService that takes a DateTime object as a parameter and return
it as a string.
> The reason I am doing this is because when sending the request thru my
compact .net app I get a time that is off by 1 hour. I am not doing
anythign at all with the DateTime at eaither end.
>
> Here is the code on the client:
> string test = mServ.GetDateTime( syncDate );
>
> Here is the Server code:
> [WebMethod]
> public string GetDateTime( DateTime aDateTime )
> {
> return( aDateTime.ToString() );
> }
>
> The result I get is:
> syncDate.ToString() "3/29/2004 5:52:58 PM" (This is what I am sending,
supposedly )
> test "3/29/2004 6:52:58 PM" (This is what I get back )
>
> In addition, if I try my WebService from explorer sending "3/29/2004
5:52:58 PM" the result comes back as expected:
> "3/29/2004 5:52:58 PM"
>
> Is this a bug, or am I missing something?
>



Relevant Pages

  • Re: DateTime WebService Discrepancy.
    ... When the datetime is sent by the webservice, ... I had left the handheld in its default timezone and it seemed ... > Ofcourse I had not even though of just passing a string as a parameter ... > locally and cut out the call to the web service. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: WSE 3.0, usernameOverTransportSecurity, custom Token Manager w/ securityTokenManager,
    ... I've added the web service call directly to my Data binding method ... expected but not present in the security header of the incoming ... the username token to the message. ... protected override string AuthenticateToken(UsernameToken token) ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Consume Web Service...
    ... to call a web service in my orchestration. ... Xml parameters as string datatypes and processes this Xml and returns ... ignoreCommit, XMessage msg) ...
    (microsoft.public.biztalk.general)
  • Re: DateTime WebService Discrepancy.
    ... When the datetime is sent by the webservice, ... > Ofcourse I had not even though of just passing a string as a parameter ... > locally and cut out the call to the web service. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: proxy error when consuming web service
    ... public string GetQuote ... I *didn't* pass anything to the proxy property of the service ... 'Assume RemoteWebService is a remote web service proxy class. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)