2016-07-14 14 views
2

私はSpring統合の初心者です。 Springの統合を使ってsoap webserviceを呼び出そうとしています。ローカルサーバーhttp://localhost:8080/DemoWebService/ticketsにWebサービスを展開しました。Spring統合フレームワークを使用したSOAP Webサービス呼び出し

以下は、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からうまく機能します。

ここに何か不足していますか?ご意見をお聞かせください。

答えて

0

Message part {http://www.xpadro.spring.samples.com/tickets}ticketRequest

あなたは本当にあなたがSOAP UIからのコードと何からそのサービスに送信するものを比較する必要があります。

JaxBで生成されたドメインクラスで適切なnamespaceを使用しないようです。

namespaceのように見えるのはws.mkyong.comである必要があります。

トピックの範囲:私は誰がxpadro :-)だと知っていますが、あなたは本当にあなたがWSDLと一貫していることを確認する必要があります。

関連する問題