Send Mock response for Soap Request - spring

We have created an soap request and sending the request using WebServiceTemplate
WebServiceTemplate.marshalSendAndReceive(request)
As my client is not ready with the server. I am trying to handle this request in my local and planning to post some dummy response.
Can you help me how I can mock this response?

If you are using CXF, see my JUnit Rule utility project. It creates an Endpoint using JaxWsServerFactoryBean.

Related

Spring Reactive Rest Log Complete Request Response Body

We have a requirement to log the complete request and response to our JSON based REST endpoints. We are going to use Spring Reactive. Is there a recommended solution that works out of the box? If not, what's the best approach to log request and response?

Not getting the API testing sampler in jmeter 3.2

I am using jmeter version 3.2 for REST API testing but i am not getting the API test request sampler in this version. Anyone who is working on the same version please let me know the option. Currently i am test the API through HTTP request sampler.
What do you mean by API test request? You should be able to test either SOAP or REST API endpoints using HTTP Request sampler, you will just need to add HTTP Header Manager to send Content-Type header, in your case it will most likely be application/json
References:
Building a SOAP WebService Test Plan
REST API Testing - How to Do it Right

Spring Integration webservice outbound gateway - capturing request and response to DB with additional values

I am using Spring integration WS 2.2 outbound gateway to invoke a webservice.
One of our requirement is to capture the soap request and response xmls to the database in addition to some other values like transaction id etc.
If i use ClientInterceptor to save the request/response to DB, it only has access to the soap request and the response but not to the values like transaction Id. So is there a way to retrieve and return the soap request and response from the interceptor OR a way to pass custom values to the interceptor?
Thanks

401 Authorization Required on REST client

I am trying to write a very simple REST client using RestTemplate and Jackson JSON.
Tried such sample from spring.io Getting error 401 Authorization Required even on localhost or even if I include it into the same Tomcat6 Eclipse project where that REST WebService is running.
We don't require any authorization on that Web Service while in Dev or local environment,
and anyway I am an authorized user.
Is that something enforced by Spring RestTemplate?
Running client as Java application on Java 1.6.
I am new to REST and JSON.
No there is no enforced Authorization required by Spring's RestTemplate. You should be able to build or launch an example simple REST webservice and send requests to it with RestTemplate without receiving this response, so either the server you are sending the requests to or something inbetween is returning this response code. Can you share any more details of the service you are communicating with? Is it something internal or a public API which may require Authorization?

custom HTTP status code with spring and restful webservice

I am new to the spring and restful framework. My server hosts 3 restful web services. I have used spring support for the restful web services to implement the server. The client sends JSON request to the server and gets JSON response. Client is based on spring support for the restful. The server returns 200/OK for successful processing, which is default.
What I want is the server to send custom HTTP status code 550 to the client in case there is an issue while processing the request. It should not throw any exception to the client. It should only send 550/an_error_object(as json) back to the client.
How is it possible with the spring support of restful ? I am doing the following on the server side.
HttpServletResponse.setStatus(550)
but, the client side is failing to recognize the status code 550; it throws an exception since org.springframework.http.HttpStatus doesn't have any enum constant '550' defined.
Any suggestions will be great!
Thanks in advance.
Rohit
1) Don't use unregistered status codes. See the registered status codes.
2) That being said, that's a bug in the Spring framework. It should deal properly with extension status codes.
It'll probably going to be fixed in version 4.3 of Spring.
https://jira.spring.io/browse/SPR-14205

Resources