473,379 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Dilbert C# WebService

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.DailyDilbertImageComplete dEventHandler(DailyDilbertImageCompleted_Handler);
wsDd.DailyDilbertImagePathAsync();
}

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

Jan 21 '07 #1
8 1836
On Sun, 21 Jan 2007 18:57:35 +0100, deciacco <a@a.comwrote:
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.DailyDilbertImageComplete dEventHandler(DailyDilbertImageCompleted_Handler);
wsDd.DailyDilbertImagePathAsync();
}

static void DailyDilbertImageCompleted_Handler(object sender,
DilbertADay.DailyDilbert.DailyDilbertImageComplete dEventArgs args)
{
Console.Write(System.Environment.GetFolderPath(Env ironment..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
Jan 21 '07 #2
My apologies...
DailyDilbert is a Web Reference to
http://www.esynaps.com/WebServices/D...lert.asmx?WSDL
Thanks..

"Stefan Z Camilleri" <sz****@szc001.comwrote in message
news:op***************@asusw2jc.lan...
On Sun, 21 Jan 2007 18:57:35 +0100, deciacco <a@a.comwrote:
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.DailyDilbertImageComplete dEventHandler(DailyDilbertImageCompleted_Handler);
wsDd.DailyDilbertImagePathAsync();
}

static void DailyDilbertImageCompleted_Handler(object sender,
DilbertADay.DailyDilbert.DailyDilbertImageComplete dEventArgs args)
{

Console.Write(System.Environment.GetFolderPath(Env ironment.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
Jan 21 '07 #3
On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri <sz****@szc001.com>
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
Jan 21 '07 #4
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" <sz****@szc001.comwrote in message
news:op***************@asusw2jc.lan...
On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri <sz****@szc001.com>
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

Jan 21 '07 #5
On Sun, 21 Jan 2007 19:26:21 +0100, deciacco <a@a.comwrote:
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" <sz****@szc001.comwrote in message
news:op***************@asusw2jc.lan...
>On Sun, 21 Jan 2007 19:08:27 +0100, Stefan Z Camilleri
<sz****@szc001.com>
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
Jan 21 '07 #6
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
Jan 21 '07 #7
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
Jan 30 '07 #8
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
Jan 30 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just...
6
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
1
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
5
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains...
5
by: | last post by:
Hi, How long do webservice objects live for? In particular, if i have static variables filled with data from a static constructor in a webservice, how long will that data persist? thxs
1
by: Mr Bojangles | last post by:
Hi, I want a do the following: From a (client side) web form, post to server side script (I'm using Javascript but anything will do), which in turn--and this is the important bit that I...
0
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.