Google endpoints can't request HTTP PATCH at localhost - java

Google auto-generates and HTTP PATCH endpoint when you code an HTTP PUT
But this PATCH endpoint doesn't run at localhost
The HTTP answer error code is 404
At GAE production server you don't have any problem
It makes himself, two consecutive calls: GET and PUT
Anyone is running PATCH at localhost ?

I planned to use that (and MERGE as well) but will now be careful. GET followed by PUT looks like a hacky workaround. Unfortunately all you can do is add your star to Support for HTTP PATCH and similar feature requests, and try to lobby others to do the same (I've added my vote).
Away from the Endpoint library I hope to implement doPatch and doMerge in an OpenData compatible servlet, and then hope that Jetty connects the HTTP requests from jQuery ajax to those methods. You might be able to try something similar by editing the generated Endpoint library, but that approach might encounter more problems. I'd appreciate feedback on how you fare.

Related

Beta program site separation

I have a site and i need to create a beta program for it. The idea is separate it in two distinct sites, one running stable application and the other the beta application.
The problem is that the URL to access stable or beta applications has to be the same and based on some rules, like header value, request body or query param the request will be forwarded to the correct site.
I tried Apache mod_proxy module, but it doesn't have the option to create specific rules, like those i need.
Can you help me with it? Any ideas how to implement that?
You can use Nginx as the front end server. And configure it to redirect to stable or beta on base of header value.

how to track a request in the webapplication. Is there any tool for this with which we can test a HTTP request

Recently came accross a question, If anybody has some idea pls share.
How to track a HTTP request in browser, OR can say how to track a request in its lifecycle.
Is there any tool to test it.
To track the lifecycle of a HTTP request and response including all its headers and content data I can recommend the tool Fiddler2. It is basically a proxy that you plug between browser and your web server. It will track all data that flows out of your browser to the web server and back. It also allows you to do nice things like changing the request or response data to test various cases.
http://www.telerik.com/fiddler
There is a great and straightforward tool for tracking HTTP requests.
It works like a client for REST services.
This is the project in google code:
https://code.google.com/p/rest-client/
And here is the .jar that you actually gonna use:
http://code.fosshub.com/WizToolsorg-RESTClient/downloads
It is not browser based as you asked, but it might help in some manner.
Hope I helped

AppEngine processing my POST requests as GET

I encountered a weird stuff and I've been struggling with it for a while now. Google AppEngine is processing my POST requests as GET. I've tried 3 different REST clients and they produced the same error (an html document that said GET is not available for the specified URL; but for God's sake I sent a POST!).
I'm using Java, and I've set the web.xml file correctly. Please note that this is not the first servlet in the project that responds to POST and others have worked properly. To complicate matters, this same servlet responds to POST normally when I run the app on my local development appengine server. I've cleaned and rebuilt the project several times and even changed the URL of the servlet but the problem still persists. Any help? Thanks.
The most common reason for this is that your POST is redirected for some reason, and redirects are always GET. What does the logging console say?
I was using the non secure url and it redirects POST to GET. Using https fixed this.

Inspecting request/response from Java/spring web service client

I have a client written in Java using the Springsource toolkit (that is, the #Service attribute) that is talking to an external webservice (completely seperate, nothing to do with my company) via HTTPS. I'm getting an exception on the marshalSendAndReceive step, which states that the content-type is coming back as text/html instead of the expected text/xml - with the message "could this be an error message?"
The webservice itself is the public test for the next version of the service, and calling the live service from the same code works fine. This particular method I am calling works fine on the live system but not on the test system.
My hunch is that the request is not correctly formatted for the test system - although only the response should have changed in the schema according to the release notes - and this is causing the service to return an error that is incorrectly parsed by my client. I am getting this error with all requests, even those that (according to the release notes) have not changed.
I have tried to use Fiddler and Wireshark to inspect the traffic, but can't get Fiddler to see it at all (I suspect this is a problem using Tomcat in STS with a proxy) and Wireshark can't decode the HTTPS stuff (I don't have the keys). I can't use HTTP, as the external service returns 403 Forbidden if I try.
I'm not the original developer, and I'm not even a Java developer. I am an experienced .NET developer, so any analogies with that will be understood - otherwise, I am a dummy and phrase your instructions/questions/possible help accordingly. As instructed by my predecessor, I have created a JAR file from the WSDL using XmlBeans and added that as a referenced library but I can't be sure that I've done that correctly, or even what it is that that is doing. It doesn't appear to have a discernable effect on things.
How can I debug this problem, and verify whether it is a problem with my client or their service?
My first goal would be getting Fiddler working. It is difficult to debug in the dark. However, where I get confused is when you discuss your client running in Tomcat in STS. Is your client a webapp?
Have you tried other tools like SoapUI to validate that the service is responding to your requests as expected?

JSONP or other alternatives?

I a deveveloping a web site that comunicates with a custom made webserver by me in Java. The web site is made in PHP/JavaScript/JQuery running on Apache and i made a simple second webserver in Java to support some designed features by me, and this server runs under another port XXXXX. The problem is, i want to make requests in jQuery to second server the domain is diferent, the page runs on domain and the $.getJSON function calls domain:XXXXX wich is not allowed. I thought user $.getJSONP but im concerning concerned issues. The connections between two points is authed (i was think by passing a token beyond the callback generated by jquery). The two poins are supported by. Is there safe in this case use $.getJSONP or exists other alternatives thinking in browsers support(IE7+ and FF3+).
Sorry for my english :)
Best regards lealoureiro
JSONP should work for your needs, however your other option would be to have a proxy service on your second server that would make the request server side. Your client-side code could then access all the data natively via json instead of jsonp.

Categories

Resources