I try to learn how to make Spring Boot SOAP web-service. I follow this description and I modified the source of this project. A added an addRequest to the XSD and generated java classes. But when I try to call the add operation with SoapUI I get error code 404. The original studentDetailRequest works fine.
The student wsdl is located http://localhost:8080/service/studentDetailsWsdl.wsdl
The CalculatorEndpoint looks like this:
package com.howtodoinjava.endpoints;
import com.howtodoinjava.repository.CalculatorService;
import com.howtodoinjava.repository.StudentRepository;
import com.howtodoinjava.xml.school.AddRequest;
import com.howtodoinjava.xml.school.AddResponse;
import com.howtodoinjava.xml.school.StudentDetailsRequest;
import com.howtodoinjava.xml.school.StudentDetailsResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
@Endpoint
public class CalculatorEndpoint
{
private static final String NAMESPACE_URI = "http://www.howtodoinjava.com/xml/school";
private final CalculatorService calculatorService;
@Autowired
public CalculatorEndpoint(CalculatorService calculatorService) {
this.calculatorService = calculatorService;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "AddRequest")
@ResponsePayload
public AddResponse add(@RequestPayload AddRequest request) {
AddResponse response = new AddResponse();
response.setReturn(this.calculatorService.add(request.getA(),request.getB()));
return response;
}
}
The Git repo with my modification is here. And another project is here for simple addRequest that I tried. If I try load http://localhost:8080/ws/calculator-service in browser I get 405 error code. (this wsdl is located at http://localhost:8080/ws/CalculatorServiceWsdl.wsdl.
I don't understand the mechanism of Spring SOAP service. What can I try next?
Ok, I changed a line like this:
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "addRequest")
(lower case 'addRequest') and this works now.