The best overloaded method match ...' has some invalid arguments

R

Raed Sawalha

Dear :

I have a compilation error generated by this scenario:
i have :

1. class Libray
2. Web Service
3. Web Application

the web application uses the WebService and the Class Libaray

inside the webservice i have one web method with argument of my pre-defined
class library( Say MessageClass) type.
and the class library calling the webservice method , so I attached the
webservice to web application and class library , so the web method in web
service expect passing the class library object ( and here the problem
occured)

this is the steps;
class myClass // object from this class should be passed to a web service
{
.......
}

class MessageClass
{
public string GetName()
{
myClass clsObject = new myClass();
wsObject.PutInFile(clsObject);//this is my webservice, and
here a compiler raised an error

}

}


in myClass I did XML serialization with no avail same error message , what
should I do in order to pass an object of user defined class to a webservice
method.

Regards
 
D

Dan Rogers

Hi Raed,

If I follow your question, I think you'll find that the class as known to
the generated proxy that was created when you did Add-Web-Reference and the
class in your DLL aren't actually, to the compiler, the same class. The
reason is that they exist in different .NET namespaces. One is in the
namespace of your proxy, and the other is in the namespace defined in your
class library. To remedy this, you will need to make the two share one
definition of the classes by opening up the proxy code, commenting out the
generated class that matches the name of the class you are seeking to
share, and then adding a "using" statement at the top of the class file.

Since your project already has a reference to the class library, this
should make the compiler link the proxy code to the classes as defined in
your class library, rather than a shadow of the classes found in the proxy
namespace.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top