Adding a Web Reference changes DataTypes ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cc

    Adding a Web Reference changes DataTypes ???

    Hi,

    I having created a simple WebService (in VS 2005) with just one WebMethod as
    follows :
    [WebMethod]
    public DataTable GetProducts()
    {
    DataTable objDataTable = null;

    // code for filling up the datatable

    return objDataTable;
    }

    Then, Adding the WebService as a Web Reference to a Client Application is
    following proxy code generated
    at the client for the WebMethod :

    public GetProductsResp onseGetProducts Result GetProducts()
    {
    object[] results = this.Invoke("Ge tProducts", new object[0]);
    return ((GetProductsRe sponseGetProduc tsResult)(resul ts[0]));
    }

    Look at the return type of the method :
    at the server it was defined as DataTable but at the client is it changed to
    an unreadable name GetProductsResp onseGetProducts Result ???

    What is happening here ? how can I make sure that the DataTable-type is used
    at the client as well ?

    thanks
    Chris


  • Cor Ligthert [MVP]

    #2
    Re: Adding a Web Reference changes DataTypes ???

    CC

    I would use VB Net that is much simpler for this,

    Cor

    "cc" <cmrchs@yahoo.c om> schreef in bericht
    news:4455044f$0 $21796$ba620e4c @news.skynet.be ...[color=blue]
    > Hi,
    >
    > I having created a simple WebService (in VS 2005) with just one WebMethod
    > as
    > follows :
    > [WebMethod]
    > public DataTable GetProducts()
    > {
    > DataTable objDataTable = null;
    >
    > // code for filling up the datatable
    >
    > return objDataTable;
    > }
    >
    > Then, Adding the WebService as a Web Reference to a Client Application is
    > following proxy code generated
    > at the client for the WebMethod :
    >
    > public GetProductsResp onseGetProducts Result GetProducts()
    > {
    > object[] results = this.Invoke("Ge tProducts", new object[0]);
    > return ((GetProductsRe sponseGetProduc tsResult)(resul ts[0]));
    > }
    >
    > Look at the return type of the method :
    > at the server it was defined as DataTable but at the client is it changed
    > to
    > an unreadable name GetProductsResp onseGetProducts Result ???
    >
    > What is happening here ? how can I make sure that the DataTable-type is
    > used
    > at the client as well ?
    >
    > thanks
    > Chris
    >
    >[/color]


    Comment

    Working...