2012-04-06 15 views
5

MuleでMuleの既存のSOAP Webサービスを設定しようとしています。私はリクエスト/レスポンスとSOAPコンポーネント(サービスA)を持つHTTPエンドポイントを持っています。MuleフローでSOAPを使用してHTTPエンドポイントを設定する

Simple SOAP flow シンプルなフローが動作するようにこの設定を構成したいと思います。 HTTPエンドポイントとSOAPサービスを設定しました。フローファイルを以下に示します。

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation=" 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd "> 
    <flow name="demoflowFlow1" doc:name="demoflowFlow1"> 
     <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> 
     <cxf:jaxws-service port="8082" serviceClass="com.myapp.serviceA.ServiceAImplService" doc:name="SOAP"/> 
    </flow> 
</mule> 

これは機能しません。私のサービスは単純なもので、文字列を取り込んで文字列を返します。

@WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService") 
public class ServiceAImpl implements IServiceA { 
    public String hello(String user) { 
     return "at service A: " + user; 
    } 
} 

私はHTTPインバウンドURL http://localhost:8081/ {!私はここに何が起こるのかわからない}と私の流れを起動し、取得しています:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
<soap:Body> 
<soap:Fault> 
<faultcode>soap:Server</faultcode> 
<faultstring>No such operation: (HTTP GET PATH_INFO: /)</faultstring> 
</soap:Fault> 
</soap:Body> 
</soap:Envelope> 

ミュールの流れはミュールStudioでアプリケーションとして実行されています、このサービスはSpringsourceのツールからSOAP Webサービスとして実行されています。

私は間違っていますか?

オリジナルWSDLはFYI http://localhost:8080/ServiceA/services/ServiceAImplPort?wsdl

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ServiceAImplService" targetNamespace="http://service.demo.myapp.com/"> 
<wsdl:types> 
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
<import namespace="http://service.demo.myapp.com/" schemaLocation="http://localhost:8080/ServiceA/services/ServiceAImplPort?xsd=serviceaimpl_schema1.xsd"/> 
</schema> 
</wsdl:types> 
<wsdl:message name="helloResponse"> 
<wsdl:part element="tns:helloResponse" name="parameters"></wsdl:part> 
</wsdl:message> 
<wsdl:message name="hello"> 
<wsdl:part element="tns:hello" name="parameters"></wsdl:part> 
</wsdl:message> 
<wsdl:portType name="IServiceA"> 
<wsdl:operation name="hello"> 
<wsdl:input message="tns:hello" name="hello"></wsdl:input> 
<wsdl:output message="tns:helloResponse" name="helloResponse"></wsdl:output> 
</wsdl:operation> 
</wsdl:portType> 
<wsdl:binding name="ServiceAImplServiceSoapBinding" type="tns:IServiceA"> 
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
<wsdl:operation name="hello"> 
<soap:operation soapAction="urn:Hello" style="document"/> 
<wsdl:input name="hello"> 
<soap:body use="literal"/> 
</wsdl:input> 
<wsdl:output name="helloResponse"> 
<soap:body use="literal"/> 
</wsdl:output> 
</wsdl:operation> 
</wsdl:binding> 
<wsdl:service name="ServiceAImplService"> 
<wsdl:port binding="tns:ServiceAImplServiceSoapBinding" name="ServiceAImplPort"> 
<soap:address location="http://localhost:8080/ServiceA/services/ServiceAImplPort"/> 
</wsdl:port> 
</wsdl:service> 
</wsdl:definitions> 

で、私は問題なしのSpringSourceツールスイートからWebサービスを実行することができます。今、GETリクエストでHTTPインバウンドURLからWebサービスを呼び出すにはどうすればよいですか? [これらのような単純なWebサービスはGETリクエストを受け取ります]

+0

SOAP Webサービスは、GETではなくPOSTでアクセスされます。あなたの場合、フローの代わりにシンプルなサービスパターンの使用を検討しましたか? http://www.mulesoft.org/documentation/display/MULE3USER/Simple+Service+Pattern –

+0

実際には、SOAP Webサービスをフローで消費することについてあまり明確ではありません。私がこのことを知ったら、私は複数のサービスへの並列呼出しがあるより複雑なフローに移り、いくつかのサービスを呼び出す間に選択ルータを使用しなければなりません。とにかく、私はフローパターンを使用する必要があります。 – r3st0r3

+0

あなたは正しい:流れのパターンはあなたが必要とするものです。 –

答えて

0

非常に簡単です... com.myapp.serviceA.ServiceAImplServiceはサービス実装クラスで、IServiceA.javaはサービスクラスです...なぜですかあなたはこれを試してみません: - := "ServiceAImplService">サービス名ServiceAImplServiceである代わりにそれを... < WSDLはなぜ

Mule Config

あなたのwsdlで間違った何かが....ありIServiceA .... ServiceAImplServiceは、私が推測するWebサービスの実装クラスであると私はあなたがあなたの方法で@WebMethodアノテーションを忘れてしまったと思います

2

流れラバにで保たれるべきです。これは基本的にあなたのエラーと言うものです:操作なし。

Hereは、あなたがそれを行う方法の非常に良い例です。

@WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService") 
public class ServiceAImpl implements IServiceA { 
    @WebMethod 
    @WebResult(name="result") 
    public String hello(@WebParam(name="user")String user) { 
     return "at service A: " + user; 
    } 
} 
関連する問題