structure and pointer problems?

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

    #1

    structure and pointer problems?

    Hello,

    I am making a service for use with gsoap. It is called
    InstTicktServer .c.

    The header file is defined as follows:

    typedef struct InstTickt__stru ct_DBInstantTck t {
    xsd__int GameNo;
    xsd__int PackNo;
    xsd__int VIRNNo;
    xsd__int LatexNo;
    xsd__int TicktStat;
    xsd__int RetailNo;
    xsd__int TermAmt;
    xsd__int LMSAmt;
    xsd__string SerialNo;
    xsd__string TermDateTime;
    xsd__string SysDateTime;
    } ;

    typedef struct InstTickt__Resp onse {
    struct InstTickt__stru ct_DBInstantTck t *DBList;
    xsd__int NoOfItems;
    };


    --------------------------------------------------------------
    Then I have the following function for the processing of the server
    code:

    int InstTickt__db_g et(struct soap *soap, xsd__string *login_name,
    xsd__string *login_password ,
    struct InstTickt__stru ct_QRYInstantTc kt *WhereClause,
    struct InstTickt__Resp onse *DBListing)
    {

    int return_code;
    int i = 0;
    int my_num_rows = 0;
    QRYInstantTckt set_clause;
    QRYInstantTckt where_clause;
    DBInstantTckt in_InstantTckt[100];

    db_reset_query_ InstantTckt(&wh ere_clause);
    strcpy(where_cl ause.QRYTermDat eTime, "01-NOV-1997");
    strcpy(where_cl ause.QRYOPTermD ateTime, "=");

    my_num_rows = db_get_InstantT ckt("scott", "tiger", in_InstantTckt, -1,
    where_clause);

    DBListing -> NoOfItems = my_num_rows;

    /*************** *************** ****
    Even though the result returns 99 rows, I just allocate 4
    cells below for testing purposes
    *************** *************** *****/
    DBListing -> DBList = (struct InstTickt__stru ct_DBInstantTck t *)
    soap_malloc(soa p, sizeof(struct InstTickt__stru ct_DBInstantTck t) *
    4);

    if (DBListing -> DBList == NULL)
    {
    return soap_receiver_f ault(soap, "Malloc Failure", "Can't allocate
    space for answer!");
    }


    /*
    MAIN PART NOT WORKING, Cell 0 gets the value and prints into
    the XML response but Cell 1 does not get the value
    */

    DBListing -> DBList[0].GameNo = 111111111;
    DBListing -> DBList[1].GameNo = 222222222;

    return SOAP_OK;
    }


    --------------------------------------------

    If you look at the resulting XML envelope below, you can see
    "111111111" for "GameNo". This is the first cell - but - I do not see
    "222222222" for "GameNo" for the second cell.

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
    xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
    xmlns:InstTickt ="urn:InstTickt "><SOAP-ENV:Body
    SOAP-ENV:encodingSty le="http://schemas.xmlsoap .org/soap/encoding/"><InstTickt:Re sponse><DBList> <GameNo>1111111 11</GameNo><PackNo> 1089956652</PackNo><VIRNNo> 0</VIRNNo><LatexNo >0</LatexNo><TicktS tat>1056768</TicktStat><Reta ilNo>167837696</RetailNo><TermA mt>0</TermAmt><LMSAmt >0</LMSAmt></DBList><NoOfIte ms>99</NoOfItems></InstTickt:Respo nse></SOAP-ENV:Body></SOAP-ENV:Envelope>


    Please tell me - what am I doing wrong????

    TIA

  • mlimber

    #2
    Re: structure and pointer problems?

    milkyway wrote:[color=blue]
    > Hello,
    >
    > I am making a service for use with gsoap. It is called
    > InstTicktServer .c.
    >
    > The header file is defined as follows:
    >
    > typedef struct InstTickt__stru ct_DBInstantTck t {
    > xsd__int GameNo;
    > xsd__int PackNo;
    > xsd__int VIRNNo;
    > xsd__int LatexNo;
    > xsd__int TicktStat;
    > xsd__int RetailNo;
    > xsd__int TermAmt;
    > xsd__int LMSAmt;
    > xsd__string SerialNo;
    > xsd__string TermDateTime;
    > xsd__string SysDateTime;
    > } ;
    >
    > typedef struct InstTickt__Resp onse {
    > struct InstTickt__stru ct_DBInstantTck t *DBList;
    > xsd__int NoOfItems;
    > };
    >
    >
    > --------------------------------------------------------------
    > Then I have the following function for the processing of the server
    > code:
    >
    > int InstTickt__db_g et(struct soap *soap, xsd__string *login_name,
    > xsd__string *login_password ,
    > struct InstTickt__stru ct_QRYInstantTc kt *WhereClause,
    > struct InstTickt__Resp onse *DBListing)
    > {
    >
    > int return_code;
    > int i = 0;
    > int my_num_rows = 0;
    > QRYInstantTckt set_clause;
    > QRYInstantTckt where_clause;
    > DBInstantTckt in_InstantTckt[100];
    >
    > db_reset_query_ InstantTckt(&wh ere_clause);
    > strcpy(where_cl ause.QRYTermDat eTime, "01-NOV-1997");
    > strcpy(where_cl ause.QRYOPTermD ateTime, "=");
    >
    > my_num_rows = db_get_InstantT ckt("scott", "tiger", in_InstantTckt, -1,
    > where_clause);
    >
    > DBListing -> NoOfItems = my_num_rows;
    >
    > /*************** *************** ****
    > Even though the result returns 99 rows, I just allocate 4
    > cells below for testing purposes
    > *************** *************** *****/
    > DBListing -> DBList = (struct InstTickt__stru ct_DBInstantTck t *)
    > soap_malloc(soa p, sizeof(struct InstTickt__stru ct_DBInstantTck t) *
    > 4);
    >
    > if (DBListing -> DBList == NULL)
    > {
    > return soap_receiver_f ault(soap, "Malloc Failure", "Can't allocate
    > space for answer!");
    > }
    >
    >
    > /*
    > MAIN PART NOT WORKING, Cell 0 gets the value and prints into
    > the XML response but Cell 1 does not get the value
    > */
    >
    > DBListing -> DBList[0].GameNo = 111111111;
    > DBListing -> DBList[1].GameNo = 222222222;
    >
    > return SOAP_OK;
    > }
    >
    >
    > --------------------------------------------
    >
    > If you look at the resulting XML envelope below, you can see
    > "111111111" for "GameNo". This is the first cell - but - I do not see
    > "222222222" for "GameNo" for the second cell.
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <SOAP-ENV:Envelope
    > xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
    > xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
    > xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
    > xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
    > xmlns:InstTickt ="urn:InstTickt "><SOAP-ENV:Body
    > SOAP-ENV:encodingSty le="http://schemas.xmlsoap .org/soap/encoding/"><InstTickt:Re sponse><DBList> <GameNo>1111111 11</GameNo><PackNo> 1089956652</PackNo><VIRNNo> 0</VIRNNo><LatexNo >0</LatexNo><TicktS tat>1056768</TicktStat><Reta ilNo>167837696</RetailNo><TermA mt>0</TermAmt><LMSAmt >0</LMSAmt></DBList><NoOfIte ms>99</NoOfItems></InstTickt:Respo nse></SOAP-ENV:Body></SOAP-ENV:Envelope>
    >
    >
    > Please tell me - what am I doing wrong????
    >
    > TIA[/color]

    I don't see a C++ *language* question in here, which means that your
    post is off-topic in this newsgroup. See the FAQ for what is on-topic
    and for some suggestions of better places to post this:



    Cheers! --M

    Comment

    • Ron Natalie

      #3
      Re: structure and pointer problems?

      milkyway wrote:[color=blue]
      > Hello,
      >
      > I am making a service for use with gsoap. It is called
      > InstTicktServer .c.
      >
      > The header file is defined as follows:
      >
      > typedef struct InstTickt__stru ct_DBInstantTck t {[/color]

      If you wrote this class, you should know that you are not allowed
      to use double underscores. They are reserved to the impelementation
      (in C++ at least, as a matter of fact this code doesn't look much
      like C++ at all, so you probably shouldn't post there).

      However, I suspect the problem is with usage of whatever soap library
      you are using which is outside the scope of either of these groups.

      Comment

      Working...