Java Springboot SOAP Web服务错误(提交响应后无法创建会话)
我在SpringBoot中使用@EndPoint注释开发了一个SOAP WS。下面是endpoint类的代码片段Java Springboot SOAP Web服务错误(提交响应后无法创建会话),java,spring,spring-boot,Java,Spring,Spring Boot,我在SpringBoot中使用@EndPoint注释开发了一个SOAP WS。下面是endpoint类的代码片段 package com.xyz.cns.services.esb.custprefdetails.service.api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ws.server.endpoint.annotation.Endpoint
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;
}
}
但是,在运行服务时,会出现一个奇怪的错误:
追加器[STDOUT\u prod]未能追加。java.lang.IllegalStateException:在提交响应后无法创建会话
这是不完整的代码。这很可能是因为关闭了
HttpServletResponse
。可能在该方法之前的某个地方调用了response#setStatus
,但根据此代码片段确实不可能知道。感谢Christopher的回复。请注意,我使用的是SpringBootStarter项目,除了这个类和应用程序类之外,没有其他类。没有编码涉及HttpServletResponse。请阅读-总结是,这不是解决志愿者问题的理想方式,可能会对获得答案产生反作用。请不要将此添加到您的问题中。