我正在尝试调用spring Web服务,但我收到以下异常
org.springframework.ws.soap.client.SoapFaultClientException: Invalid request[UnmarshallingFailureException]
这是我的弹簧配置
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
...
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
<util:list id="packagesToScanList" list-class="java.util.ArrayList">
<value>webservice.messages.lmsapi.serviceoperations</value>
<value>webservice.messages.lmsapi.types.user</value>
<value>webservice.messages.lmsapi.types.customer</value>
<value>webservice.messages.lmsapi.types.enrollment</value>
<value>webservice.messages.lmsapi.types.orggroup</value>
<value>webservice.messages.lmsapi.types.securityroles</value>
<value>webservice.messages.lmsapi.types.trainingplan</value>
<value>webservice.messages.lmsapi.types.usergroup</value>
<value>org.w3._2001.xmlschema</value>
</util:list>
<!-- Configure Spring Web Services -->
<bean id="lmsApiWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"
p:defaultUri="${lmsapi.uri}"
p:marshaller-ref="lmsApiJaxbMarshaller"
p:unmarshaller-ref="lmsApiJaxbMarshaller" />
<bean id="lmsApiJaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
p:packagesToScan-ref="packagesToScanList"/>
这是我如何称呼这个
public AddUserResponse createUser(AddUserRequest addUserRequest) {
System.out.println();
JAXBElement<AddUserResponse> response = (JAXBElement<AddUserResponse>)lmsApiWebServiceTemplate.marshalSendAndReceive(addUserRequest);
AddUserResponse addUserResponse = (AddUserResponse)response.getValue();
return addUserResponse;
}
在调试控制台中打印
[org.springframework.ws.client.MessageTracing.sent] - Sent request [SaajSoapMessage {http:/webservice/message/lmsapi/serviceoperations}AddUserRequest]
[org.springframework.ws.client.MessageTracing.received] - Received response [SaajSoapMessage {http://schemas.xmlsoap.org/soap/envelope/}Fault] for request [SaajSoapMessage {http://webservice/message/lmsapi/serviceoperations}AddUserRequest]
[org.springframework.ws.client.core.WebServiceTemplate] - Received Fault message for request [SaajSoapMessage {http://webservice/message/lmsapi/serviceoperations}AddUserRequest]
这意味着webservice正在调用
为什么我得到这个解组错误?有没有什么方法可以看到spring发送和接收的请求以及我获得此异常的确切位置?
由于
答案 0 :(得分:1)
解组错误包含在SOAP Fault中。因此,它发生在服务器端,而不是客户端。您应该检查服务器端日志,看看那里发生了什么。
关于记录的问题:reference documentation向您展示如何。