• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

POST call returning 404

 
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This is my  post REST API



The issue is, this post call is returning 404 sometimes when i pass certain data in notes variable , i.e
Tell me a little about your "Wish List" so I can refine this search for you.

Call me any time


But when i pass data something like test in notes, it is returning proper response.
This issue is not occurring when i am running the application in local. But occurring in production environment.
So, I have added the log, to see whether it is entering the POST method, in the case of 404 response, it is not even entering the method. The log is not being logged.

Anyone has idea what would be the cause for the issue. It is behaving weirdly.

Thanks in advance.
 
Sheriff
Posts: 22715
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you sending these parameters? With a form post or as query parameters? And what do your URL and request body look like?
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the part of query parameters, and this is how it looks like
localhost:8080/xhr/save?name=priya&id=6625&notes=Tell%20me%20a%20little%20about%20your%20%22Wish%20List%22%20so%20I%20can%20refine%20this%20search%20for%20you.%20%0A%0ACall%20me%20any%20time&email=abc@abc.com
 
Saloon Keeper
Posts: 14663
330
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it work when you remove the line feed characters (%0A) from the query string?
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it worked even with new line character like:

Tell me a little about your "Wish List" so I can refine this search for you.

Call
, but not working with

Tell me a little about your "Wish List" so I can refine this search for you.

Call m


i.e not working for any extra character after 'm'
 
Stephan van Hulst
Saloon Keeper
Posts: 14663
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like there is a limit on the HTTP request line size. You should contact a system administrator about this.
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, when i am running application in local, it is working fine.
 
Rob Spoor
Sheriff
Posts: 22715
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're doing a POST. That means that using query strings isn't necessary. Take that entire query string, and use it as the request body. Set the content type to application/x-www-form-urlencoded. The URL simply becomes http://localhost:8080/xhr/save.

You can't simply test this in a browser without a simple HTML form. You can create that, but I suggest installing Postman and using that to send your requests. This is much more powerful, as it also allows you to add headers or use PUT / DELETE - two things that you cannot do in the browser without some JavaScript.
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I know post can't be performed through browser, in my case, it is done as part of the application.
I can't change the query string parameters to body, cause it's working fine, only in this case of data, it is working weirdly.

And also with this data, it is working fine when i am running application in local, one of the QA servers, but this is the issue that is occurring in other QA server and Production.

I am really not understanding why it's happening like this.
Can you please suggest some way to find the root cause other than shifting the data to body.
 
Stephan van Hulst
Saloon Keeper
Posts: 14663
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vishnu priyag wrote:But, when i am running application in local, it is working fine.


That's why I suggested contacting a system administrator. This is not an issue with the application. It's an issue with the application container that the application is running in. I'm assuming you don't have access to the production server, so you need help from an administrator.
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay got it. But i have access to QA server, can you please guide me where do i need to make changes
 
Stephan van Hulst
Saloon Keeper
Posts: 14663
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really. I don't know what application container you are running, nor if there are any reverse proxies running in front of your web server that are rewriting HTTP requests.
 
vishnu priyag
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat is the web container that is being used, and no proxy at least for QA server.
 
Rob Spoor
Sheriff
Posts: 22715
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vishnu priyag wrote:I can't change the query string parameters to body, cause it's working fine, only in this case of data, it is working weirdly.


So it's not working fine. For me, "working fine" means "working fine in all situations".

And also with this data, it is working fine when i am running application in local, one of the QA servers, but this is the issue that is occurring in other QA server and Production.


That means there's either an encoding issue, or more likely a reverse proxy before the application like Apache's httpd, nginx or IIS. In both cases the system administrator needs to help out, like Stephan already said.
 
Stephan van Hulst
Saloon Keeper
Posts: 14663
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tomcat url length limit
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic