【发布时间】:2016-07-14 13:17:35
【问题描述】:
我是 Spring 集成的新手。我正在尝试使用 Spring 集成调用soap webservice。我在本地服务器http://localhost:8080/DemoWebService/tickets 上部署了网络服务。
下面是Spring应用上下文xml中的配置。
<int:gateway id="systemEntry" default-request-channel="requestChannel" default-reply-channel="responseChannel"
service-interface="xpadro.spring.integration.ws.gateway.TicketService"/>
<int:channel id="requestChannel"/>
<int:channel id="responseChannel" />
<int-ws:outbound-gateway id="marshallingGateway"
request-channel="requestChannel" reply-channel="responseChannel"
uri="http://localhost:8080/DemoWebService/tickets" marshaller="marshaller"
unmarshaller="marshaller"/>
<oxm:jaxb2-marshaller id="marshaller" contextPath="xpadro.spring.integration.ws.types" />
下面是写成网关和Junit测试类的接口。
public interface TicketService {
/**
* Entry to the messaging system. All invocations to this method will be intercepted and sent to the SI "system entry" gateway
*
* @param request
*/
@Gateway
public TicketResponse invoke(TicketRequest name );}
代码形式的 Junit 测试
@Test
public void testInvocation() throws InterruptedException, ExecutionException {
TicketRequest request = new TicketRequest();
request.setFilmId("aFilm");
request.setQuantity(new BigInteger("3"));
TicketResponse response = service.invoke(request);
assertNotNull(response);
assertEquals("aFilm",response.getFilmId());
assertEquals(new BigInteger("5"), response.getQuantity());
}
但是当我运行测试时,我遇到了错误。请帮忙。谢谢..
WARNING: Interceptor for {http://ws.mkyong.com/}tickets has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Message part {http://www.xpadro.spring.samples.com/tickets}ticketRequest was not recognized. (Does it exist in service WSDL?)
此服务在 SOAP UI 中运行良好。
我在这里遗漏了什么吗?请指教。
【问题讨论】: