I am working soap service using spring WS , I want the endpoint need to changed at handle request method in endpoint interceptor based on some condition. Is it possible to change endpoint method at handle request method ?
Related
I dont mean supporting async responses (like described here https://cloud.spring.io/spring-cloud-contract/reference/html/project-features.html#contract-dsl-async).
I mean situation when after my request I get response synchronously. And after that I want to get some request back from stub. Smth like this:
request from my service to stub:
POST /subscription {subscription params...}
synchronous response from stub:
202 Accepted
after a while request from stub to my service:
POST /subscription-answer {subscription with more params...}
My requirement is to call siebel soap webservice, In the process handle request and response on a same method call, so that I can add token to the request header from the apache common pool and once get the response with token, grab the token from response and send it to pool. Here I have mechanism to verify old token too,
I need request token and response token on same class.
Future planning to add retry mechanism.
Currently I am using SI Http outbound gateway.
Any thoughts, appreciate it.
Thanks
So, what you need is named pre- and post-process. Not sure why you don't use Spring Integration WS support for calling that Siegel service, but even with the HTTP you can get a gain via Interceptor abstraction.
What I mean that you can inject RestTemplate into HTTP Outbound Gateway supplied with the ClientHttpRequestInterceptor implementation to provide a desired logic.
If you'd use WS Outbound Gateway, you could do that in the similar ClientInterceptor abstraction.
Of course, you can achieve that via HeaderMapper implementation, but that has different responsibility...
I found the way to achieve this,
Created a class to extends HttpRequestExecutingMessageHandler than overrided handleRequestMessage()
http://docs.spring.io/spring-integration/reference/html/http.html#http-outbound
Using Spring MVC I have a webservice that receives several parameters and inserts them to the Database returning to the client the id of inserted row. How can I execute other function after the id has been sent to the client? How can I schedule a method to run after the webservice return?
Spring supports #Async annotation.
Which means any call to the annotated method returns immediately. Hence you could call the method right before you return the response from your controller.
Check here for more details.
Another way is to use AOP and create a thread that handles the after response possessing!
I want to understand how a RESTful web service identifies if a correct request method is called.
For example,
I have a REST service it exposes one operation which is of type GET.
Assume a REST client has invoked the operation using a wrong request method(PUT).
In this scenario, how the service/framework identifies a correct request method is invoked?
I have gone through various posts to understand the scenario but I don't find any information.
Please let me know your comments.
The first line sent in an HTTP request looks like this:
GET /index.html HTTP/1.1
The HTTP request thus contains the HTTP method (POST, PUT, GET, etc.). The framework reads this method, and invokes the Java method that is mapped (thanks to annotations, or XML configuration, or whatever) to the URL (also contained in the HTTP request, as shown above) and the HTTP method. If none is found, then an error response is sent back (405 Method Not Allowed, if the resource is found, but with another method, or 404 if the resource is not found).
It's the http protocol not REST that checks headers, and reports back with an error code.
REST is sort of a strategy, not an implementation.
Hope this helps.
I am calling Restful web service via ajax call. On this page i have google recaptcha whose parameter passing via get httprequest parameter. In rest service, i am getting http request object via #Context but it's returning null for both parameter.
How to resolve this issue