text/xml for soap request/response

This commit is contained in:
Greg Gauthier 2021-04-09 20:19:24 +01:00
parent c4199c15da
commit 87253ab4ff
4 changed files with 6 additions and 9 deletions

View File

@ -10,6 +10,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
public class ApiConfig implements WebMvcConfigurer {
@Override
public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {
configurer.defaultContentType(MediaType.valueOf(MediaType.APPLICATION_XML_VALUE));
configurer.defaultContentType(MediaType.valueOf(MediaType.TEXT_XML_VALUE));
}
}

View File

@ -13,16 +13,13 @@ import java.util.Objects;
@RestController
@RequestMapping(
consumes = MediaType.APPLICATION_XML_VALUE,
produces = MediaType.APPLICATION_XML_VALUE)
consumes = MediaType.TEXT_XML_VALUE,
produces = MediaType.TEXT_XML_VALUE)
public class MockController {
@PostMapping(path ="/call1")
public String postCall1(@RequestBody String xmlRequestBody){
String responseBody = getStaticResponse("soap-example.xml");
System.out.println(xmlRequestBody);
System.out.println(responseBody);
return responseBody;
return getStaticResponse("soap-example.xml");
}
private String getStaticResponse(String fileName){

View File

@ -1,4 +1,4 @@
<?xml version = "1.0"?>
<?xml version = "1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">

View File

@ -1,4 +1,4 @@
<?xml version = "1.0"?>
<?xml version = "1.0 encoding="utf-8""?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV = "http://www.w3.org/2001/12/soap-envelope"
SOAP-ENV:encodingStyle = "http://www.w3.org/2001/12/soap-encoding">