Returning Object From Webservice

A

Asim Qazi

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>false</m_bStatus>
<m_szErrorCode>210</m_szErrorCode>
<m_szMessage>Error 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
 
J

Jared

The code I use to call a Web Method is;

WebService.MyWebService webService = new WebService.MyWebService();

webService.MyResponse myResponse = webService.MyResponse();

You can call you indiviadual values using;

bool bitStatus = myResponse.m_bStatus;
string strError = myResponse.m_szErrorCode;
string strMessage = myResponse.m_szMessage;

In this example;

WebService = The folder under App_WebReferences
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
 
A

Asim Qazi

Thanks a lot Jared, it really worked :) will ping the list again if i got
any other issue :)


God Bless you.



aSIM.
 

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

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top