我在SpringBoot中使用@EndPoint注释开发了SOAP WS。下面是端点类的代码段。
package com.xyz.cns.services.esb.custprefdetails.service.api;
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;
import com.xyz.cns.services.esb.custprefdetails.service.model.GetCustomerPreferenceRequest;
import com.xyz.cns.services.esb.custprefdetails.service.model.GetCustomerPreferenceResponse;
import com.xyz.cns.services.esb.custprefdetails.service.transform.OutputTransformer;
@Endpoint
public class CustomerPreferenceDetailsWebServiceController {
private static final String NAMESPACE_URI = "http://schemas.xyz.com/services/getCustomerPreferenceDetails";
/* @Autowired
private GetCustomerPreferenceResponse getCustomerPreferenceResponse;*/
//@Autowired
//CustomerPreferenceDetailsWebServiceHandler custPrefDetailsWSHandler;
@Autowired
OutputTransformer ot;
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getCustomerPreferenceRequest")
@ResponsePayload
public GetCustomerPreferenceResponse getCustomerPreference(@RequestPayload GetCustomerPreferenceRequest request) {
GetCustomerPreferenceResponse getCustomerPreferenceResponse= new GetCustomerPreferenceResponse();
//getCustomerPreferenceResponse = custPrefDetailsWSHandler.getCustomerPreferenceDetails(request.getName());
getCustomerPreferenceResponse = ot.transformCustPrefRes();
return getCustomerPreferenceResponse;
}
}
但是,在运行服务时,出现一个奇怪的错误:
Appender [STDOUT_prod]无法添加。 java.lang.IllegalStateException:提交响应后无法创建会话