Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Using user defined types

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil Greg - 18 Feb 2005 15:41 GMT
Hi,
I'm pretty new to this, so I hope I'm not completely off-track. I built a
web service in C++ that I'm accessing trough another C++ client. I have no
problems with the regular web service functionalities, but I want to define a
class on the server side that I could return to the client trough a function,
and then access this class' functions on the client side.
I guess I'm doing this wrong. Here is how my code looks:
namespace WebServer
{
 [Serializable]
 public __gc class TestClass
 {      
   static String* m_staticString = S"TestString";

 public: String* GetStaticString(){return m_staticString;};
 };

   public __gc
       class WebServerClass : public System::Web::Services::WebService
   {
       //(...)
    public:
       [System::Web::Services::WebMethod]
       TestClass* GetTestClass()
       {
         return new TestClass();
       }
   };  

Now I can declare the TestClass on the client side, but I get a
"GetStaticString is not a member of  localhost::TestClass" error when I try
to access that function. Also, when I look at the localhost.h generated file,
the only things regarding TestClass I see are:
   public __gc class TestClass;
and
   /// <remarks/>
   
[System::Xml::Serialization::XmlTypeAttribute(Namespace=S"http://tempuri.org/")]
   public __gc class TestClass {
   };

What gives?
Keenan Newton - 19 Feb 2005 16:49 GMT
Web Services will not serialize the implementation of a class, just the
public fields and properties (the data payload).  Web Services is a way
of passing messages around not the object itself (implementation).
Phil Greg - 21 Feb 2005 12:53 GMT
That's what I understood, but then, in my example, shouldn't the
GetStaticString method show up?

> Web Services will not serialize the implementation of a class, just the
> public fields and properties (the data payload).  Web Services is a way
> of passing messages around not the object itself (implementation).
Keenan Newton - 21 Feb 2005 22:45 GMT
No GetStaticString is a method, not a property or field.  Compare it to
exdporting a Excel file to csv.  you just store the data, not the Excel
functions you also create.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.