how to call webservice using wiremock
See original GitHub issueHi ,
I am new to wire mock, I have written very simple Spring Rest webservice and I want to use wiremock to call this service instead my controler, can you help how can I modify code to make sure, I use wiremock. its very simple code as follow,
@Controller @RequestMapping(“/state”) public class StateController {
@RequestMapping(value = "/{code}", method = RequestMethod.GET)
public @ResponseBody String getState(@PathVariable String code) {
String result;
if (code.equals("KL")) {
result = "Kerala";
} else if (code.equals("GJ")){
result = "Gujarat";
} else{
result = "Default State";
}
return result;
}
urgent help appreciated!!!
Regards, Lirin.
Issue Analytics
- State:
- Created 10 years ago
- Comments:15
Top Results From Across the Web
Using WireMock with SOAP Web Services in Java
I'm WireMock's creator. I've used WireMock to mock a collection of SOAP interfaces on a client project quite recently, so I can attest...
Read more >Working with SOAP - WireMock
SOAP APIs typically use the SOAPAction header to select the appropriate action for the call. Although you can sometimes avoid this, it's usually...
Read more >Wiremock and how to emulate SOAP Calls | by Daniel S. Blanco
Add the @WebService annotation to the class containing the logic. · Add the @WebMethod annotation to each of the methods we want to...
Read more >how to call webservice using wiremock · Issue #102 - GitHub
The only way you can get WireMock to create the XML file is by using the record function. So, if your service is...
Read more >Introduction to WireMock - Baeldung
When a WireMock server is in action, we can set up expectations, call the service and then verify its behaviors. 2. Maven Dependencies....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Tom,
I am trying to post data to Wire mock using Rest Assured POST API. Rest Assured Syntax: given().contentType(“application/json”).and().body(“Your_body_here”).when().post(“http://some_url”);
Will something like this work: given().when().body(requestBody).post(url).contentType(“application/json”); or should i write a wrapper over Rest Asssured POST call to integrate with Wire Post. Something like this: public static void postToWireMock(String url,String requestBody,int responseCode){ stubFor(WireMock.get(urlEqualTo(url)) .withHeader(“Accept”, equalTo(“application/json”)) .willReturn(aResponse() .withStatus(responseCode) .withHeader(“Content-Type”, “application/json”) .withBody(requestBody))); given().when().body(requestBody).post(url);
Hi Tom, Very interesting. Can we have any sample to test SOAP client using Wire Mock with soap request and soap response xml