2012-01-11 2 views
7

次のサンプルWSDLファイルを使用して、SOAP UI(バージョン3.5)で新しいプロジェクトを生成し、テストスイート、テストケース、モックサービスのサンプルを作成しました。xmlレスポンスではなくhtmlを返すSoapUI MockService

WSDL

<definitions name="HelloService" 
    targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl" 
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 

    <message name="SayHelloRequest"> 
     <part name="firstName" type="xsd:string"/> 
    </message> 
    <message name="SayHelloResponse"> 
     <part name="greeting" type="xsd:string"/> 
    </message> 

    <portType name="Hello_PortType"> 
     <operation name="sayHello"> 
     <input message="tns:SayHelloRequest"/> 
     <output message="tns:SayHelloResponse"/> 
     </operation> 
    </portType> 

    <binding name="Hello_Binding" type="tns:Hello_PortType"> 
    <soap:binding style="rpc" 
     transport="http://schemas.xmlsoap.org/soap/http"/> 
    <operation name="sayHello"> 
     <soap:operation soapAction="sayHello"/> 
     <input> 
     <soap:body 
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      namespace="urn:examples:helloservice" 
      use="encoded"/> 
     </input> 
     <output> 
     <soap:body 
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
      namespace="urn:examples:helloservice" 
      use="encoded"/> 
     </output> 
    </operation> 
    </binding> 

    <service name="Hello_Service"> 
     <documentation>WSDL File for HelloService</documentation> 
     <port binding="tns:Hello_Binding" name="Hello_Port"> 
     <soap:address 
      location="http://www.examples.com/SayHello/"/> 
     </port> 
    </service> 
</definitions> 

私は、WSDLへのリンクを参照することにより、ブラウザ経由でモックサービスとアクセスを起動することができますし、それを表示することができます。

しかし、デフォルトで生成されたsoapリクエスト(次のように)を使用すると、私が設定したsoapレスポンスではなく、htmlレスポンス(ウェブページと思われます)が返されます。 MOCK

ON

サンプルの応答を次のように私はサンプルの応答を設定した

HTTP/1.1 200 OK 
Content-Type: text/html; charset=iso-8859-1 
Transfer-Encoding: chunked 
Server: Jetty(6.1.x) 

<html><body><p>There are currently 1 running soapUI MockServices</p><ul><li><a href="/mockHello_Binding?WSDL">Hello_Binding MockService</a></li></ul></p></body></html> 

REQUEST

POST http://localhost:8088/SayHello/ HTTP/1.1 
Accept-Encoding: gzip,deflate 
Content-Type: text/xml;charset=UTF-8 
SOAPAction: "sayHello" 
User-Agent: Jakarta Commons-HttpClient/3.1 
Host: localhost:8088 
Content-Length: 467 

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:examples:helloservice"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <urn:sayHello soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <firstName xsi:type="xsd:string">James</firstName> 
     </urn:sayHello> 
    </soapenv:Body> 
</soapenv:Envelope> 

応答3210

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:examples:helloservice"> <soapenv:Header/> <soapenv:Body> <urn:sayHelloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <greeting xsi:type="xsd:string">?</greeting> </urn:sayHelloResponse> </soapenv:Body> </soapenv:Envelope> 

デフォルトの応答として設定されているため、返されない理由はわかりません。

提案がありますか?私がこれを進めるのに役立つものは+ 1です。

おかげ

+0

同じ問題が発生しました。http://www.soapui.org/forum/viewtopic.php?t=4177 – Jimmy

+0

奇妙なところから - ウェブサービスを呼び出して応答を受け取る簡単なJavaクライアントを作成できますか?それから? –

答えて

10

なしサービスは、あなたの要求からエンドポイントURLのために開始されません:http://localhost:8088/SayHello/。開始された唯一のサービスは、サービス応答に報告されたURL http://localhost:8088/mockHello_Bindingにあります。 SoapUIは、存在しないものがリクエストされたときに、HTMLページ内の開始されたすべてのモックサービスのリストを返します。この問題を解決するには、エンドポイントアドレスの修正を検討してください。

-1

私はBizTalk 2010 Send PortとMock SOAPUI webserviceで同様の問題があります。 2つのURLが異なっていることがわかりました IEでこれを開くと、HTMLの応答が表示されます。 http://localhost:8088/MockUpdateBasicHttp

IEでこれを開いたとき、私は通常、成功を意味する空白の白い画面が表示されました。 http://localhost:8088//MockUpdateBasicHttp

正しいURLには、ポート番号の後に1つの「/」が付いています。 http://localhost:8088/MockUpdateBasicHttp

1

soap ui 5.4.0を使用して同じ問題が発生しました。それは、作成されたモックサービスのパスが間違っていたことが起こっていることがあります。

ソープのUIをクリックすると、作成されたモックサービスのプロパティボタンの下部に、パスが/ mockBindingserviceのように表示されます。

変更するには、作成したモックサービスをダブルクリックし、設定ボタン(停止ボタンと開始ボタンの隣にあります)をクリックします。/へのパスを変更してホストを再確認します。

保存して、サービスを開始してください。今すぐ働かなければならない。

私はそれが古い投稿であることを知っていますが、うまくいけばそれはanbodyを探しているsombodyを助けるでしょう。

+0

ツアーを終了してください。あなたはあなたの答えにあなたの石鹸のバージョン番号を掲載しました。この方法で少しでも...最新の;-) – ZF007

0

あなたが当てているURLが間違っています。 ソリューション: 1)新しいプロジェクトを作成 2)WSDLをインポートする 3)Mockerviceを作成するをチェックしてください 4)次に、mockserviceを実行するURLを確認してください:: - > mockSearchURL(例) 5)ヒットHTTP://{IP}:8088/mockSearchURL

完了!

関連する問題