Request-URI Too Long  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Request-URI Too Long

Postby SBarnes » Thu Mar 14, 2019 12:46 pm

Hi Mike

In trying to add an order through the web api we are getting an error that says "Request-URI Too Long" would it be correct to assume this is because this is an order with hundreds of lines in it and the only way to resolve the issue is to reduce the data being sent?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Request-URI Too Long

Postby Mike.Sheen » Thu Mar 14, 2019 12:50 pm

I wouldn't have thought so as creating sales orders is a POST operation and so the URI doesn't contain the DTO, the body does - unless the content type has been overridden to application/x-www-form-urlencoded.

Are you able to see the request logs for any clues?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Request-URI Too Long

Postby SBarnes » Thu Mar 14, 2019 4:11 pm

Hi Mike,

I actually now suspect the following code may be the culprit, after I saw more of the log, the customer has some very long part numbers and if the order was 500 lines long then that might explain it.

Code: Select all
              string[] parts = order.Details.Select(e => e.StockCode).ToArray();
                inqry.PartNoIn = parts;
                ServiceStack.QueryResponse<IN_Main> IN_MainQueryResponse;
                IN_MainQueryResponse = client.Get<ServiceStack.QueryResponse<IN_Main>>(inqry);
               
                foreach (DetailOrderLine line in order.Details)
                {
                    List<IN_Main> items = IN_MainQueryResponse.Results;
                    int count = items.FindAll(e => e.PartNo == line.StockCode && e.Status == 0).ToList().Count;
                    line.CodeExitsInJiwa = (count != 0);
                    line.InventoryID = count != 0 ? items.Find(e => e.PartNo == line.StockCode && e.Status == 0).InventoryID : "";
                    order.Log.Add("Checking in Jiwa for : " + line.StockCode);
                }
                LogoutGetRequest logout = new LogoutGetRequest();
                LogoutGetResponse lresp = client.Get<LogoutGetResponse>(logout);
                order.ChekcInJiwa = true;


What is the maximum length and is there a way to increase it?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Request-URI Too Long  Topic is solved

Postby Mike.Sheen » Fri Mar 15, 2019 9:35 am

Right - so the problem is not a sales order operation, but the GET of parts with a given list of part numbers

Code: Select all
IN_MainQueryResponse = client.Get<ServiceStack.QueryResponse<IN_Main>>(inqry);


That would pass as parameters each Part No. - the request would be something like:

https://api.jiwa.com.au/Queries/IN_Main?PartNoIn=1170,1171


Where the PartNoIn parameter value is a csv separated list of parts you are retrieving - and if there are many and they are long, you'll exceed the maximum request length configured.

SBarnes wrote:What is the maximum length and is there a way to increase it?


The default maximum length I believe is 4MB - but you can override this in the JiwaAPISelfHostedService.exe.config file under the system.web section by setting the maxRequestLength attribute of the httpRuntime property - e.g.:

Code: Select all
<configuration>
   <system.web>
      <httpRuntime maxRequestLength ="2097151"/>
   </system.web>
</configuration>
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest

cron