473,659 Members | 2,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Wind ow 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.LogS ervice logService = new LogService.LogS ervice();
LogService.wind ow window = new LogService.Wind ow();
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.LogS ervice logService = new LogService.LogS ervice();
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.Log Service.Log(Log Service.Window) ' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Wind ow

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 2147
<bj*****@gmail. comwrote in message
news:11******** *************@o 5g2000hsb.googl egroups.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.LogS ervice logService = new LogService.LogS ervice();
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.Log Service.Log(Log Service.Window) ' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Wind ow

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.saunder s at trizetto.com>
wrote:
<bjor...@gmail. comwrote in message

news:11******** *************@o 5g2000hsb.googl egroups.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.LogS ervice logService = new LogService.LogS ervice();
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.Log Service.Log(Log Service.Window) ' has some invalid
arguments
2) Argument '1': cannot convert from House.Window to LogService.Wind ow
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.Wind ow 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.Wind ow.
Scott
Mar 30 '07 #4
"Scott Holman" <sh*****@micros .comwrote in message
news:Ov******** ******@TK2MSFTN GP05.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.Wind ow 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.Wind ow.
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
4977
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 Parameter. I can call the first Method without Problems, the Parameter can be deserialized by the WebService. But if I want to call the second Method and give it an Array of Parameters, then the following exception is thrown by the WebService:...
7
3085
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 works fine. So I deploy the webservice on a remote machine (Linux box) and I get an error when calling the service. BUT: I can retrieve the WSDL and make a webreference in my VS.NET project, so obviously I (or more correct: My VS.NET project) am...
5
2592
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 fine so far. My problem is that when I call a web method to modify the dataset inside the Web service it is never updated and I get no errors. currentPeriods method will always give me 1 even if I call ChangeDataset and call currentPeriods...
1
2233
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 that page the webservice method does'nt work. So how shud i solve this.
1
4032
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 provided with a set of Dll that implement the proxy needed to consume this web service. I'm now wrapping these dlls in a .Net webservice that can be consumed with Visual studio the familliar way.
0
1550
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 v3.0 and the vb code that i use to call the webservice is as follows tmp=getMacaddress()' Dim oSoapClient As MSSOAPLib30.SoapClient30 Set oSoapClient = New MSSOAPLib30.SoapClient30 Call...
0
1178
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 server that resides in a different domain from the server hosting the Web page. However, Web servers can communicate directly with other Web servers, even if they reside in different domains. Therefore, it is possible to use the Web server that is...
0
1572
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 a seperate thread using an async call. All the articles I can find are either on implementing an async webpage, or calling an async webservice. I can not however find any article on how to make calls within a webservice asynchronous. Consider...
0
1733
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 works fine when called from a win32 app. The problem I am encountering is that the string being returned to the caller is in Chinese (No, I'm not kidding). (I need it to be in English). Background: The DLL uses 3 pchar parms, 2 in and one out. In...
0
1154
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 sometimes does not run i cant understant why? void Page_Loaded(object sender, RoutedEventArgs e) { Search.Click += new RoutedEventHandler(Search_Click); }
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.