473,320 Members | 2,029 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,320 software developers and data experts.

Calling a method on a webservice

Hi,

I have a question related to webservices on the Microsoft platform.

Context:
I have two projects. One is called LogService. The other is called
client. The LogService is a C# webservice developed on VS.NET 2005.
The client is a seperate project developed in VS.NET 2005 which uses
(in the project using a webreference) the webservice LogService.
Introduction:
I'm trying to call the method Log with an argument Window on a
webservice called LogService. This Window Class is defined under the
namespace House in the webservice project. So if i want to instantiate
a Window in the LogService, i do the following: "House.Window window =
new House.Window();".

If i want to call the Log method on the client project which has a web
reference to the LogService named LogService i do the following:
LogService.LogService logService = new LogService.LogService();
LogService.window window = new LogService.Window();
logService.Log(window);

But...:
My situation is different.
For some reason ( i'm not going to explain it here ), i do not use the
Window definition from LogService. Instead, on the client project i
also have a namespace House with a class Window, which is exactly
identical to that on the webservice LogService. To call the method Log
i do the following:
LogService.LogService logService = new LogService.LogService();
House.Window window = new House.Window();
logService.Log(window);

But... then i get some errors which i can not get rid of.
The errors i get:
1) The best overloaded method match for
'LogService.LogService.Log(LogService.Window)' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Window

And i also can't cast between the two classes.

My Question: Does somebody know how to fix those errors? Has it
something to do with Namespaces? I'm lost here.

Mar 29 '07 #1
4 2128
<bj*****@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
....
>
But...:
My situation is different.
For some reason ( i'm not going to explain it here ), i do not use the
Window definition from LogService. Instead, on the client project i
also have a namespace House with a class Window, which is exactly
identical to that on the webservice LogService. To call the method Log
i do the following:
LogService.LogService logService = new LogService.LogService();
House.Window window = new House.Window();
logService.Log(window);

But... then i get some errors which i can not get rid of.
The errors i get:
1) The best overloaded method match for
'LogService.LogService.Log(LogService.Window)' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Window

And i also can't cast between the two classes.

My Question: Does somebody know how to fix those errors? Has it
something to do with Namespaces? I'm lost here.
The two classes are not related in any way that matters to C#. Of course
you're going to get errors. You'd get the same result if you passed an
"int".

John
Mar 29 '07 #2
On Mar 29, 7:27 pm, "John Saunders" <john.saunders at trizetto.com>
wrote:
<bjor...@gmail.comwrote in message

news:11*********************@o5g2000hsb.googlegrou ps.com...
...


But...:
My situation is different.
For some reason ( i'm not going to explain it here ), i do not use the
Window definition from LogService. Instead, on the client project i
also have a namespace House with a class Window, which is exactly
identical to that on the webservice LogService. To call the method Log
i do the following:
LogService.LogService logService = new LogService.LogService();
House.Window window = new House.Window();
logService.Log(window);
But... then i get some errors which i can not get rid of.
The errors i get:
1) The best overloaded method match for
'LogService.LogService.Log(LogService.Window)' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Window
And i also can't cast between the two classes.
My Question: Does somebody know how to fix those errors? Has it
something to do with Namespaces? I'm lost here.
The two classes are not related in any way that matters to C#. Of course
you're going to get errors. You'd get the same result if you passed an
"int".
Ok, they are not related for C#. For me they are. Actually, for me
they are identical. So is there a way to typecast between the both? Or
do i have to create a copy constructor? Or is there another solution
to this problem?
Mar 30 '07 #3
As john pointed out the classes are not the same. If your using WCF it is
fairly easy to modify the generated proxy code and replace class
implementations. If you are using pre .net3.0 web services you may be able
to do something similar.

You need to modify the generated client proxy class and replace the
generated LogService.Window class with House.Window. You need to make sure
that your implementation of House.Window is decorated with the same
attributes as the class in the generated client proxy. After applying the
same attributes you then need to modify the generated client proxy class to
use House.Window instead of LogService.Window.
Scott
Mar 30 '07 #4
"Scott Holman" <sh*****@micros.comwrote in message
news:Ov**************@TK2MSFTNGP05.phx.gbl...
As john pointed out the classes are not the same. If your using WCF it is
fairly easy to modify the generated proxy code and replace class
implementations. If you are using pre .net3.0 web services you may be
able to do something similar.

You need to modify the generated client proxy class and replace the
generated LogService.Window class with House.Window. You need to make
sure that your implementation of House.Window is decorated with the same
attributes as the class in the generated client proxy. After applying the
same attributes you then need to modify the generated client proxy class
to use House.Window instead of LogService.Window.
To my mind, it would be safer not to edit the proxy class, as it is a
generated class. Instead, yes, create a copy constructor.

John
Mar 30 '07 #5

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

Similar topics

7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
5
by: joeblast | last post by:
I have a Web service that gets the financial periods and hold a reference to a disconnected dataset built at initialization. Web methods work on the dataset inside the web service. Everything is...
1
by: batista | last post by:
Hi, I'm using webservice.htc to call a non-secure(without https) webservice method from a webpage. Now, if the webpage is not under https then everything works fine. But, when enable ssl in...
1
by: jens Jensen | last post by:
Hello , i'm calling a webservice generated with oracle webservice java tools. I'm not able to add a web reference to a .net client the usual way with visual studio 2005. I was therefore...
0
by: ananth | last post by:
Hi all, I have an webservice written in Lotus Notes and now i am calling this webservice in visual basic to pass data from visual basic to lotus notes database .I am using a MSSOAP tool kit...
0
by: gengyue | last post by:
Hi, Refer to my previous post "Calling web serive from JSP", I found an article on msfn2.microsoft.com. "Using the WebService behavior, it is not possible to call a remote method directly on a...
0
by: Paul Hadfield | last post by:
Hi, From reading various articles on scalability issues, I understand that there is only a finite number of ASP.NET worker threads and any long running task within ASP.NET should be fired off on...
0
by: BornTOCode | last post by:
Hello, I am attempting to call a (Delphi) win32 DLL from a Delphi.Net webservice. I am using a slightly modified version of the hello world webservice that comes with Delphi 2006. The DLL...
0
by: vineetbindal | last post by:
Hi, I have a webservice which i am calling on button click event. this webservice is serving twi methods, my problem is that allthough this service will call both the methods but one of them...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.