Returning Object From Webservice

Discussion in 'ASP .Net' started by Asim Qazi, Oct 16, 2006.

  1. Asim Qazi

    Asim Qazi Guest

    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
    Asim Qazi, Oct 16, 2006
    #1
    1. Advertising

  2. Asim Qazi

    Jared Guest

    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



    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>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
    Jared, Oct 16, 2006
    #2
    1. Advertising

  3. Asim Qazi

    Asim Qazi Guest

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


    God Bless you.



    aSIM.


    "Jared" <> wrote in message
    news:...
    > 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
    >
    >
    >
    > 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>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

    >
    Asim Qazi, Oct 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karuppasamy

    WebService – Returning an Object

    Karuppasamy, Jan 15, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    527
    Karuppasamy
    Jan 15, 2004
  2. Web Team @ Borough of Poole

    Returning CollectionBase from WebService

    Web Team @ Borough of Poole, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,289
    Web Team @ Borough of Poole
    Apr 27, 2005
  3. Replies:
    11
    Views:
    646
    Christos Georgiou
    May 2, 2006
  4. Matthew Holton

    WebService â?" Returning an Object

    Matthew Holton, Jan 15, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    150
    Matthew Holton
    Jan 15, 2004
  5. Jean-Michel Pichavant

    Mocked object returning another Mocked object

    Jean-Michel Pichavant, Jul 13, 2012, in forum: Python
    Replies:
    1
    Views:
    184
    Ulrich Eckhardt
    Jul 13, 2012
Loading...

Share This Page