Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:11:02+00:00 2026-06-01T15:11:02+00:00

I have this error appearing in my web service and even though I’v had

  • 0

I have this error appearing in my web service and even though I’v had a look at the articles on the null issue, I am not able to find how to fix this error

this is my code:

    SendInvUpdate.InvServices.UpdateRatePackagesRequest urq = new SendInvUpdate.InvServices.UpdateRatePackagesRequest();
    SendInvUpdate.InvServices.UpdateRatePackagesOperationResponse ors = new SendInvUpdate.InvServices.UpdateRatePackagesOperationResponse();


    protected void Page_Load(object sender, EventArgs e)
    {
        Int64 HID = 819942;
        Int64 HRID = 154482;

        SendInvUpdate.InvServices.UpdateRatePackagesRequest request = new SendInvUpdate.InvServices.UpdateRatePackagesRequest();

        ChannelManagerAccount account = new ChannelManagerAccount();
        request.HotelId = HID;

        int avail = 4;
        DateTime frodte = Convert.ToDateTime("2012-04-12");
        DateTime todte = Convert.ToDateTime("2012-04-30");
        int NoofRatePackages = 3;
        UpdateRatePackageRequest[] RatePackages = new UpdateRatePackageRequest[NoofRatePackages];
        string res;
        request.RatePackages = new UpdateRatePackageRequest[NoofRatePackages];
        request.RatePackages = RatePackages;

        UpdateRatePackageRequest rp = new UpdateRatePackageRequest();

        for (int i = 0; i < NoofRatePackages; i++)
        {        
            rp.RatePackageId = HRID;        

            RateDetails[] Rates = new RateDetails[NoofRatePackages];

            rp.Rates = new RateDetails[NoofRatePackages];
            rp.Rates = Rates;

            RateDetails rd = new RateDetails();

            for (int j = 0; j < NoofRatePackages; j++)
            {
                rd.Availability = avail;

                rd.AvailabilityApplicationType = SendInvUpdate.InvServices.AvailabilityApplicationType.SET;

                rd.FromDate = frodte;

                rd.ToDate = todte;

            }

        }

       SendInvUpdate.InvServices.InventoryServiceClient icc = new SendInvUpdate.InvServices.InventoryServiceClient();            
        // ( *Line where the error appears*)
        ors = icc.UpdateRatePackages(request); 

        res = ors.Results.ToString();          
    }

I know that it has something to do with the RateDetails array and initialising the value of the RateDetails to that instant of request but I am not sure how or what to do with regards to that. In debug mode when looking at values of rp there are no values for rp.Rates[0],rp.Rates[1],rp.Rates[2] also RatePackages[0],RatePackages[1],RatePackages[2] are also null so I have a strong feeling thats where my problem is but I don’t have a clue on how to fix.

Would be grateful for any sort of insight to where I’ve gone wrong!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:11:03+00:00Added an answer on June 1, 2026 at 3:11 pm

    Move the initialization of icc service reference inside your page_load code as

    SendInvUpdate.InvServices.InventoryServiceClient icc = new SendInvUpdate.InvServices.InventoryServiceClient(); 
    ors = icc.UpdateRatePackages(request); ( Line where the error appears)
    

    I’m not an expert in asp.net but you can’t base your code on global vars if you don’t save them in some persistent container (search about SESSION, VIEWSTATE)

    EDIT:
    also something seems wrong here

       UpdateRatePackageRequest[] RatePackages = new UpdateRatePackageRequest[NoofRatePackages]; 
       string res; 
       request.RatePackages = new UpdateRatePackageRequest[NoofRatePackages]; 
       request.RatePackages = RatePackages; 
    

    should be only request.RatePackages = new UpdateRatePackageRequest[NoofRatePackages]; ?

    EDIT2:
    You send to the InventoryServiceClient an object request that contains an array of UpdateRatePackageRequest, but after creation of the array you don’t set any instance of UpdateRatePackageRequest. So I suppose the InventoryServiceClient fails when reading the values from the array.
    I will try to change your for loop in this way

       for (int i = 0; i < NoofRatePackages; i++)       
       {               
            UpdateRatePackageRequest rp = new UpdateRatePackageRequest(); 
            request.RatePackages[i] = rp;
            ....
    

    Same error with RateDetails. You create the array, but don’t set any value of your array with an actual instance of RateDetails

            for (int j = 0; j < NoofRatePackages; j++) 
            { 
                RateDetails rd = new RateDetails();  
                rp.Rates[j] = rd;
                ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error message could not load assembly 'system.data.entity, version 4.2.0.0, culture=neutral,publickeytoken=b77a5c561934e089' or
I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
I have this error that is keeping me from moving forward. I basically have
I have this error when I am trying to read the file: Exception in
I have this error NOTICE: UNDEFINED VARIABLE: LOGO IN C:\WAMP\WWW\SITE\TOOLS\SMARTY\SYSPLUGINS\SMARTY_INTERNAL_DATA.PHP ON LINE 291 CALL
I have this code and I couldn't run it because i get this error:
I install plugin open_id_authentication and have this error: /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require': no such file to
I wonder if anyone can help - I have this error showing recently when
I am learning python and have this error . I can figure out where\what
I have a unique issue - I am designing a web application that creates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.