473,395 Members | 1,466 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,395 software developers and data experts.

Using user defined types

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(Names pace=S"http://tempuri.org/")]
public __gc class TestClass {
};

What gives?
Nov 23 '05 #1
3 1053
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).

Nov 23 '05 #2
That's what I understood, but then, in my example, shouldn't the
GetStaticString method show up?

"Keenan Newton" wrote:
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).

Nov 23 '05 #3
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.

Nov 23 '05 #4

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

Similar topics

1
by: Robbie | last post by:
Hi Guys Wonder if you could help me. Basically I produce an accounts package that uses a SQL 2000 DB as the RDBMS. I always instruct users to login as 'sa' and the relevant password when...
2
by: Miles Ashton | last post by:
A common request for enhancement to applications is to "make this field bigger". I know I've been caught with increasing a field size, and then spending hours debugging because another stored proc...
6
by: sandSpiderX | last post by:
Hi, How do i use this definition of overloaded operator, T& operator*(T*); like struct X {}; X ox; X* px=&ox;
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
2
by: Les Stockton | last post by:
In VB6 you had a Type and End Type to define your own data types. Are the only ways to do this in VB.Net with enums, struct and class. How's the best way to define user defined types?
27
by: Randy | last post by:
Is there a way to override operators for user-defined types (e.g., typedefs) rather than class types? I'm trying to override the extractor operator for a user-defined enumeration type but...
8
by: Gary Nastrasio | last post by:
If I compile with /clr:safe, which is exactly meant by saying I can't use "Native Types" in my code? Is a native type something such as float, short, or int? Thanks, Gary
30
by: junky_fellow | last post by:
I was looking at the source code of linux or open BSD. What I found that lots of typedefs were used. For example, consider the offset in a file. It was declared as off_t offset; and off_t is...
6
by: Chris Johnson | last post by:
Greetings all. I am really stuck on this one as I can't seem to grok if I am abusing the C++ language or if I am simply using components of the C++ Standard Library incorrectly. Here is the code:...
2
by: Bharath | last post by:
Hello All, Can you please let me know if we can do pointer arthrmetic using operator overloading? If not, can you please explain why it's not supported by compiler? I tried below e.g. which was...
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: 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?
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...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.