PC Review


Reply
Thread Tools Rate Thread

Dilbert C# WebService

 
 
deciacco
Guest
Posts: n/a
 
      21st Jan 2007
What's wrong with this code?
It runs, but nothing happends.
Thanks!

***************************************************
using System;
using System.Collections.Generic;
using System.Text;

namespace DilbertADay
{
class Program
{
static void Main(string[] args)
{
DailyDilbert.DailyDilbert wsDd = new DilbertADay.DailyDilbert.DailyDilbert();
wsDd.DailyDilbertImageCompleted += new DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventHandler(DailyDilbertImageCompleted_Handler);
wsDd.DailyDilbertImagePathAsync();
}

static void DailyDilbertImageCompleted_Handler(object sender, DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventArgs args)
{
Console.Write(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
}
}
}
***************************************************

 
Reply With Quote
 
 
 
 
Stefan Z Camilleri
Guest
Posts: n/a
 
      21st Jan 2007
On Sun, 21 Jan 2007 18:57:35 +0100, deciacco <(E-Mail Removed)> wrote:

> What's wrong with this code?
> It runs, but nothing happends.
> Thanks!
>
> ***************************************************
> using System;
> using System.Collections.Generic;
> using System.Text;
>
> namespace DilbertADay
> {
> class Program
> {
> static void Main(string[] args)
> {
> DailyDilbert.DailyDilbert wsDd = new
> DilbertADay.DailyDilbert.DailyDilbert();
> wsDd.DailyDilbertImageCompleted += new
> DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventHandler(DailyDilbertImageCompleted_Handler);
> wsDd.DailyDilbertImagePathAsync();
> }
>
> static void DailyDilbertImageCompleted_Handler(object sender,
> DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventArgs args)
> {
> Console.Write(System.Environment.GetFolderPath(Environment..SpecialFolder.DesktopDirectory));
> }
> }
> }
> ***************************************************


What is DailyDilbert?

This code should give you an error since there is no class called
DailyDilbert defined here... or maybe it is defined beneath this code?

If such is the case, can you paste that code too?

--
- Stefan Z Camilleri
- www.szc001.com
 
Reply With Quote
 
deciacco
Guest
Posts: n/a
 
      21st Jan 2007
My apologies...
DailyDilbert is a Web Reference to
http://www.esynaps.com/WebServices/D...lert.asmx?WSDL
Thanks..

"Stefan Z Camilleri" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
On Sun, 21 Jan 2007 18:57:35 +0100, deciacco <(E-Mail Removed)> wrote:

> What's wrong with this code?
> It runs, but nothing happends.
> Thanks!
>
> ***************************************************
> using System;
> using System.Collections.Generic;
> using System.Text;
>
> namespace DilbertADay
> {
> class Program
> {
> static void Main(string[] args)
> {
> DailyDilbert.DailyDilbert wsDd = new
> DilbertADay.DailyDilbert.DailyDilbert();
> wsDd.DailyDilbertImageCompleted += new
> DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventHandler(DailyDilbertImageCompleted_Handler);
> wsDd.DailyDilbertImagePathAsync();
> }
>
> static void DailyDilbertImageCompleted_Handler(object sender,
> DilbertADay.DailyDilbert.DailyDilbertImageCompletedEventArgs args)
> {
>
> Console.Write(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
> }
> }
> }
> ***************************************************


What is DailyDilbert?

This code should give you an error since there is no class called
DailyDilbert defined here... or maybe it is defined beneath this code?

If such is the case, can you paste that code too?

--
- Stefan Z Camilleri
- www.szc001.com


 
Reply With Quote
 
Stefan Z Camilleri
Guest
Posts: n/a
 
      21st Jan 2007
On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri <(E-Mail Removed)>
wrote:

> DailyDilbert


Excuse my previous email, just found out what DailyDlbert is. Do you have
a reference to it though? Am not seeing one

--
- Stefan Z Camilleri
- www.szc001.com
 
Reply With Quote
 
deciacco
Guest
Posts: n/a
 
      21st Jan 2007
That is the entire program.cs file...
The reference shows up under the Solution Explorer under "Web References".
The solution builds without any errors and runs, but nothing happends.
In debugging it looks like the "DailyDilbertImageCompleted_Handler" never
gets called.
Thanks

"Stefan Z Camilleri" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri <(E-Mail Removed)>
> wrote:
>
>> DailyDilbert

>
> Excuse my previous email, just found out what DailyDlbert is. Do you have
> a reference to it though? Am not seeing one
>
> --
> - Stefan Z Camilleri
> - www.szc001.com



 
Reply With Quote
 
Stefan Z Camilleri
Guest
Posts: n/a
 
      21st Jan 2007
On Sun, 21 Jan 2007 19:26:21 +0100, deciacco <(E-Mail Removed)> wrote:

> That is the entire program.cs file...
> The reference shows up under the Solution Explorer under "Web
> References".
> The solution builds without any errors and runs, but nothing happends.
> In debugging it looks like the "DailyDilbertImageCompleted_Handler" never
> gets called.
> Thanks
>
> "Stefan Z Camilleri" <(E-Mail Removed)> wrote in message
> news(E-Mail Removed)...
>> On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri
>> <(E-Mail Removed)>
>> wrote:
>>
>>> DailyDilbert

>>
>> Excuse my previous email, just found out what DailyDlbert is. Do you
>> have
>> a reference to it though? Am not seeing one
>>
>> --
>> - Stefan Z Camilleri
>> - www.szc001.com

>
>


Hi, the file was not attached, yet in the meantime I came across this that
might help you

http://www.dotnetpowered.com/dailydilbert.aspx


--
- Stefan Z Camilleri
- www.szc001.com
 
Reply With Quote
 
Laurent Bugnion [MVP]
Guest
Posts: n/a
 
      21st Jan 2007
Hi,

deciacco wrote:
> That is the entire program.cs file...
> The reference shows up under the Solution Explorer under "Web References".
> The solution builds without any errors and runs, but nothing happends.
> In debugging it looks like the "DailyDilbertImageCompleted_Handler" never
> gets called.
> Thanks


First, the URL you give for the web service has a typo inside. Make sure
that it's not the case in the actual web reference.

http://www.esynaps.com/WebServices/D...lert.asmx?WSDL
instead of
http://www.esynaps.com/WebServices/D...bert.asmx?WSDL

(BTW, if you're in touch with the web service creator, you should tell
him that using tempuri.org as a namespace is not recommended).

Then, you call an asynchronous web service in the "main" method of the
Console application. However, after the request is sent, the application
terminates (when main is finished, the application ends). When the web
service comes back, the application is finished already.

To solve this, you can either call the service synchronously (in which
case, the application waits for the response before ending), or you have
to wait for the response yourself. If you want my advice, since this
seems to be a test application only, use a WinForms application instead
of a Console app.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
 
Reply With Quote
 
Thomas Gustafsson
Guest
Posts: n/a
 
      30th Jan 2007
If however you want to keep your application a console application, you could define a global boolean variable (isFinished), and use this to keep the main thread alive (while(!isFinished) until the asynchronous operation has completed (inFinished = true).

Best regards
Thomas

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      30th Jan 2007
On its own, that would be a bad thing (even if you remembered to make
it volatile); a far better option would be something like a
ManualResetEvent, or you can actually do the same thing with just
Monitor if you want.

An even better option... if you aren't going to do anything else, then
don't make it async... unless of course that is completely out of your
control.

Marc


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dilbert Yahoo Widgets Sam spade Windows XP General 1 29th Jul 2009 10:24 PM
Daily Dilbert GadGet Fixed! Spirit Windows Vista General Discussion 0 6th May 2009 09:26 PM
IE8 and Daily Dilbert Gadget Spirit Windows Vista General Discussion 1 1st May 2009 05:17 PM
pop-up with Dilbert.com? =?Utf-8?B?QWJyYXhpYXM=?= Windows XP Internet Explorer 11 4th Nov 2005 05:46 PM
WWW::Dilbert 1.02 - A Dilbert of the Day cartoon strip archive and retrieval module. Gordon Darling Freeware 0 14th Aug 2004 02:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:08 PM.