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

return type of web method should be a class object in web service

hello
I want to return more than 1 values from my web method. For this I am
planing to create a class which will have number of properties, will
set properties and return object of that class in my web method. But
question is how the web service user will get access of that class?
Should I define that class in web service itself? any other method? for
example

public class MyService
{
[webMethod]
public Classb myMethod()
{
Classb objClassb = new Classb();
objClassb.Prop1 = "test";
objClassb.Prop2 = "test1";
objClassb.Prop3 = "test2";
return objClassb;
}
}

where should I define "Classb" class?

thanks

Aug 30 '06 #1
4 1561
To be honest, it doesn't really matter too much, but somewhere near the
web-service would probably be best for your convenience... Classb must of
course be serializable (with read/write properties (or at a push, fields)).

When used via a web-service, the caller will simply see Classb as defined at
the same level as the web-service itself (via the asmx/wsdl), and your
client (via wsdl.exe or wsewsdl.exe) will generate its own copy of the class
from the asmx structure. The caller will not see the original namespace nor
assembly details.

Marc
Aug 30 '06 #2
As you use a non typed dataset than you have in my idea the easiest class to
be used to pass serialized to everywhere but especially in a webservice, you
can use it excluding the scheme and including the scheme.

I hope this helps,

Cor

<pr************@yahoo.comschreef in bericht
news:11**********************@74g2000cwt.googlegro ups.com...
hello
I want to return more than 1 values from my web method. For this I am
planing to create a class which will have number of properties, will
set properties and return object of that class in my web method. But
question is how the web service user will get access of that class?
Should I define that class in web service itself? any other method? for
example

public class MyService
{
[webMethod]
public Classb myMethod()
{
Classb objClassb = new Classb();
objClassb.Prop1 = "test";
objClassb.Prop2 = "test1";
objClassb.Prop3 = "test2";
return objClassb;
}
}

where should I define "Classb" class?

thanks

Aug 30 '06 #3
hello
thanks for your help. I will try as per suggestions by both of you.

thanks

Aug 31 '06 #4
hello
thanks for your help. I will try as per suggestions by both of you.

thanks

Aug 31 '06 #5

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

Similar topics

1
by: Derrick | last post by:
I have the below simple class - public class MyClass { protected string m_stName; protected string m_stCode; protected int m_iId; public MyClass() {}
12
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport)...
2
by: RJ | last post by:
I've been trying to find documentation that explains limitation of possible types that a webmethod can return. I realize xml serialization must take place to return the specified type. Must the...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
5
by: Paul Hasell | last post by:
Hi, I'm trying to invoke a web method asynchronously but just can't seem to get it to tell me when it has finished! Below is the code I am (currently) using: private void...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
0
by: hazz | last post by:
After generating an XML Web Service proxy class using wsdl.exe, I added a proxy class to a new VS2005 project to consume my webservice. I want to call the method ReturnCustomer() whose proxy...
1
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
9
by: Alexander Widera | last post by:
hi, is it possible to return an object of an unknown (but not really unknown) type with an method? i have the following situation: - a variable (A) of the type "object" which contains the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.