I am using citrus as server for my use case, and trying to hit the server with HTTP post with some request. I am using dispatching-endpoint-adapter/static-response-adapter with mappingStrategy/mappingKeyExtractor. I have couple of questions. Any inputs on this would be helpful.
1.How do i validate my request payload?
2.How do i read the response from server. I am trying to implement as below but i dont get any response back
HttpPost request = new HttpPost("http://localhost:8080/search/customer");
I do not see Citrus related code here. Also you did not mention the error that you get while executing the Http communication.
In general I would suggest to use Spring's RestTemplate for creating the Http request as your application is a Spring Boot application as I know from other questions. Handling the response is very easy then, too. Please refer to the Spring Boot samples and official documentation how to produce Http request/response communication.
Also I do not really understand your use case of your code setup. What exactly do you want to do? Do you need an automated integration test that is constantly running with your code base or do you just want to explore the Http communication in a proof of concept test.
I got the response using static response adapter, some issues w.r.t response format due to which i didnt get the response earlier.
Sorry if i was not clear on my use case with my previous post. I am trying to use citrus server (to replace the 3rd party call) to automate the integration test to run against my code base. I need to validate the request header, method and request payload in citrus server before sending the response back to the client (which is my spring boot application). Used the below for header validation but dont see this working.
Am i doing it right?
I didnt get any error, it always sends the response back irrespective of header
I read the documentation and I was able to validate the request header/uri in server side when I run citrus test using Java DSL by passing the request and header through citrus client. But my use case is to pass the request payload/header/uri from my spring boot application to citrus server and to get the response back only if the request payload/header/uri matches.
Below is the code that i have in citrus-context.xml. Please let me know if you need any other details to help me on this issue.