structure and pointer problems?

Discussion in 'C Programming' started by milkyway, Dec 8, 2005.

  1. milkyway

    milkyway Guest

    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__struct_DBInstantTckt {
    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__Response {
    struct InstTickt__struct_DBInstantTckt *DBList;
    xsd__int NoOfItems;
    };


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

    int InstTickt__db_get(struct soap *soap, xsd__string *login_name,
    xsd__string *login_password,
    struct InstTickt__struct_QRYInstantTckt *WhereClause,
    struct InstTickt__Response *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(&where_clause);
    strcpy(where_clause.QRYTermDateTime, "01-NOV-1997");
    strcpy(where_clause.QRYOPTermDateTime, "=");

    my_num_rows = db_get_InstantTckt("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__struct_DBInstantTckt *)
    soap_malloc(soap, sizeof(struct InstTickt__struct_DBInstantTckt) *
    4);

    if (DBListing -> DBList == NULL)
    {
    return soap_receiver_fault(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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><InstTickt:Response><DBList><GameNo>111111111</GameNo><PackNo>1089956652</PackNo><VIRNNo>0</VIRNNo><LatexNo>0</LatexNo><TicktStat>1056768</TicktStat><RetailNo>167837696</RetailNo><TermAmt>0</TermAmt><LMSAmt>0</LMSAmt></DBList><NoOfItems>99</NoOfItems></InstTickt:Response></SOAP-ENV:Body></SOAP-ENV:Envelope>


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

    TIA
     
    milkyway, Dec 8, 2005
    #1
    1. Advertising

  2. milkyway

    mlimber Guest

    milkyway wrote:
    > 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__struct_DBInstantTckt {
    > 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__Response {
    > struct InstTickt__struct_DBInstantTckt *DBList;
    > xsd__int NoOfItems;
    > };
    >
    >
    > --------------------------------------------------------------
    > Then I have the following function for the processing of the server
    > code:
    >
    > int InstTickt__db_get(struct soap *soap, xsd__string *login_name,
    > xsd__string *login_password,
    > struct InstTickt__struct_QRYInstantTckt *WhereClause,
    > struct InstTickt__Response *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(&where_clause);
    > strcpy(where_clause.QRYTermDateTime, "01-NOV-1997");
    > strcpy(where_clause.QRYOPTermDateTime, "=");
    >
    > my_num_rows = db_get_InstantTckt("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__struct_DBInstantTckt *)
    > soap_malloc(soap, sizeof(struct InstTickt__struct_DBInstantTckt) *
    > 4);
    >
    > if (DBListing -> DBList == NULL)
    > {
    > return soap_receiver_fault(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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><InstTickt:Response><DBList><GameNo>111111111</GameNo><PackNo>1089956652</PackNo><VIRNNo>0</VIRNNo><LatexNo>0</LatexNo><TicktStat>1056768</TicktStat><RetailNo>167837696</RetailNo><TermAmt>0</TermAmt><LMSAmt>0</LMSAmt></DBList><NoOfItems>99</NoOfItems></InstTickt:Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
    >
    >
    > Please tell me - what am I doing wrong????
    >
    > TIA


    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:

    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9

    Cheers! --M
     
    mlimber, Dec 8, 2005
    #2
    1. Advertising

  3. milkyway

    Ron Natalie Guest

    milkyway wrote:
    > 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__struct_DBInstantTckt {


    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.
     
    Ron Natalie, Dec 8, 2005
    #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. Robert W Hand

    Re: Pointer to structure Problems

    Robert W Hand, Jul 17, 2003, in forum: C Programming
    Replies:
    1
    Views:
    363
    Steve Graham
    Jul 17, 2003
  2. milkyway

    structure and pointer problems?

    milkyway, Dec 8, 2005, in forum: C Programming
    Replies:
    0
    Views:
    265
    milkyway
    Dec 8, 2005
  3. Replies:
    6
    Views:
    371
    Jack Klein
    Aug 27, 2006
  4. milkyway

    structure and pointer problems?

    milkyway, Dec 8, 2005, in forum: C++
    Replies:
    2
    Views:
    556
    Ron Natalie
    Dec 8, 2005
  5. A
    Replies:
    27
    Views:
    1,602
    Jorgen Grahn
    Apr 17, 2011
Loading...

Share This Page