473,608 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Returning Object From Webservice

Hi All
public class MyResponse
{
public bool m_bStatus;
public string m_szErrorCode;
public string m_szMessage;
}

i m returning this object from Webservice WebMethod, if i test this service
from its Service description its returning me

<MyResponse xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">

<m_bStatus>fals e</m_bStatus>
<m_szErrorCode> 210</m_szErrorCode>
<m_szMessage>Er ror Occurred.</m_szMessage>
</MyResponse>

but when i m testing it using my client i m getting the name of my class, i
want to get the returning XML when i call the webmethod from my Client.
please help.

aSIM
Oct 16 '06 #1
2 1625
The code I use to call a Web Method is;

WebService.MyWe bService webService = new WebService.MyWe bService();

webService.MyRe sponse myResponse = webService.MyRe sponse();

You can call you indiviadual values using;

bool bitStatus = myResponse.m_bS tatus;
string strError = myResponse.m_sz ErrorCode;
string strMessage = myResponse.m_sz Message;

In this example;

WebService = The folder under App_WebReferenc es
MyWebService = The name of you web service class.
MyResponse = The name of your web method.

Hope this makes sense and is waht you were after.

Cheers

Jared

Asim Qazi wrote:
Hi All
public class MyResponse
{
public bool m_bStatus;
public string m_szErrorCode;
public string m_szMessage;
}

i m returning this object from Webservice WebMethod, if i test this service
from its Service description its returning me

<MyResponse xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">

<m_bStatus>fals e</m_bStatus>
<m_szErrorCode> 210</m_szErrorCode>
<m_szMessage>Er ror Occurred.</m_szMessage>
</MyResponse>

but when i m testing it using my client i m getting the name of my class, i
want to get the returning XML when i call the webmethod from my Client.
please help.

aSIM
Oct 16 '06 #2
Thanks a lot Jared, it really worked :) will ping the list again if i got
any other issue :)
God Bless you.

aSIM.
"Jared" <ja***********@ gmail.comwrote in message
news:11******** *************@f 16g2000cwb.goog legroups.com...
The code I use to call a Web Method is;

WebService.MyWe bService webService = new WebService.MyWe bService();

webService.MyRe sponse myResponse = webService.MyRe sponse();

You can call you indiviadual values using;

bool bitStatus = myResponse.m_bS tatus;
string strError = myResponse.m_sz ErrorCode;
string strMessage = myResponse.m_sz Message;

In this example;

WebService = The folder under App_WebReferenc es
MyWebService = The name of you web service class.
MyResponse = The name of your web method.

Hope this makes sense and is waht you were after.

Cheers

Jared

Asim Qazi wrote:
Hi All
public class MyResponse
{
public bool m_bStatus;
public string m_szErrorCode;
public string m_szMessage;
}

i m returning this object from Webservice WebMethod, if i test this
service
from its Service description its returning me

<MyResponse xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">

<m_bStatus>fals e</m_bStatus>
<m_szErrorCode> 210</m_szErrorCode>
<m_szMessage>Er ror Occurred.</m_szMessage>
</MyResponse>

but when i m testing it using my client i m getting the name of my
class, i
want to get the returning XML when i call the webmethod from my Client.
please help.

aSIM

Oct 16 '06 #3

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

Similar topics

1
410
by: Karuppasamy | last post by:
H I have a WebService calling a Method in a Remote Object. The Remote method Returns an Object. This Webservice also returns the same object. All things are working fine when this Web Service is running in a Windows XP. But when I am trying to run the same webservice in a Windows 2000 Advanced Server Machine, I am getting the following error “System.Web.Services.Protocols.SoapException: Server was unable to process request. ...
0
968
by: Toby Mathews | last post by:
Hi there I am trying to return an instance of a class from a web service that contains a collection of instances of another class. I have three classes: Person MyEmails MyEmail Person is the 'base' class, which may contain an instance of
1
7265
by: Knecke | last post by:
Hi all. I have a problem with returning a custom Result object with webservice. The classes i use is described below (some fields and properties is removed) public class Result { int statusCode;
5
10364
by: LS | last post by:
Can a WebMethod return an Interface type? Can we pass an interface parameter ? Example : public interface IEntity { long Id { get; set; } string Name { get; set; } }
6
12481
by: rlcavebmg | last post by:
I am new to Web Services and .NET development, and I have a question. I am writing a service that will create a bitmap image and return it to the client. First, I wrote a method that looked like this: public System.Drawing.Bitmap CreateImage() {...} When I tried to create the web reference in my client program, I got an error message stating that the System.Drawing.Bitmap object could not be serialized because it does not have a...
5
19577
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
1
5540
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two other properties... bool error; string lastError; My whole class looks like this... using System;
7
3544
by: sameer | last post by:
Hi all, Application environment : VB.Net desktop application,.NET 1.1 Framework, VS 2003. communicates between the database and the application is done over webservices using ADO.NEt Datasets. Returned dataset is Gzip compressed and is then decompressed on the receiving side. Every thing works good, the problem is that it takes a lot of time for the
1
1451
by: Ronchese | last post by:
Helllo. I need to return a XML from my WebService, but I'm not getting the result as a XML. I mean, instead of receiveing a tag (<xyy></xyz>), I'm receiving it encoded (with &lt; or &gt;). There is some right way to return the correct XML from my WebService? Just for example, the WebMethod looks like it:
0
8495
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8145
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6011
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
5475
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
3960
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
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
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
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.