尝试通过WSO2 API Manager发布Mule ESB服务

时间:2014-11-25 23:02:32

标签: api mule wso2-am

我创建了一个Mule ESB服务,并将其作为典型的http端点(http://localhost:8081/getAppsByName)公开。然后,我使用Mule端点作为后端资源("生产端点"在WSO2-speak中)在WSO2 API Manager中创建了一个API。 当我尝试访问WSO2 API Manager端点(http://localhost:8280/getAppsByName)时,我得到了一个" 404 Not Found"在身体中回复以下消息 - "Cannot bind to address "http://localhost:8081http://localhost:8081/getAppsByName" No component registered on that endpoint"。 (骡子端点)。

我还在Mule控制台中收到以下消息 -

"No receiver found with secondary lookup on connector: connector.http.mule.default with URI key: 
WARN  2014-11-25 16:08:46,323 [[getappsbyname].http.request.dispatch.8081.01] org.mule.transport.http.HttpConnector: Receivers on connector are: {
http://localhost:8081/getAppsByName=HttpMessageReceiver{this=315dfb09, receiverKey=http://localhost:8081/getAppsByName, endpoint=http://localhost:8081/getAppsByName}"

我可以直接从浏览器成功访问Mule端点,所以我知道它有效。我在WSO2 API Manager中创建了几个成功的API,所以我知道我在那里做了什么。

我想将WSO2 API Manager用作网关/代理,并使用Mule ESB作为后端资源。 有谁知道让WSO2 API Manager和Mule ESB以这种方式工作的秘诀?

我使用Anypoint Studio 2014年10月发布版本ID:201410161901和WSO2 API Manager ver 1.7

这是我的骡子流程:

<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="xxx" password="xxx" database="xxx" doc:name="MySQL Configuration"/>
<data-mapper:config name="Map_To_JSON" transformationGraphPath="map_to_json.grf" doc:name="Map_To_JSON"/>
<flow name="getappsbynameFlow1" doc:name="getappsbynameFlow1">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="getAppsByName" doc:name="GetAppsByName"/>
    <expression-transformer expression="#[java.net.URLDecoder.decode(message.inboundProperties['appname'])]" doc:name="HTML Decode Expression"/>
    <set-payload value="#[message.payload]" doc:name="Set Payload"/>
    <logger message="Payload=#[message.payload]" level="INFO" doc:name="Logger"/>
    <db:select config-ref="MySQL_Configuration" doc:name="Database">
        <db:dynamic-query><![CDATA[SELECT `Id`,`AppName` FROM `applications` WHERE `AppName` like '%#[message.payload]%';]]></db:dynamic-query>
    </db:select>
    <data-mapper:transform config-ref="Map_To_JSON" doc:name="Map To JSON"/>
</flow>

这是我的WSO2生产终点(Mule服务):

http://localhost:8081/getAppsByName

这是我的WSO2代理端点(面向消费者的端点):

http://localhost:8280/getAppsByName/1

这是我的Synapse配置文件:

<?xml version="1.0" encoding="UTF-8"?><api xmlns="http://ws.apache.org/ns/synapse" name="apicreator--GetAppsByName" context="/getAppsByName" version="1" version-type="url">
    <resource methods="POST GET OPTIONS DELETE PUT" url-mapping="/*">
        <inSequence>
            <property name="POST_TO_URI" value="true" scope="axis2"/>
            <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
                <then>
                    <send>
                        <endpoint name="apicreator--GetAppsByName_APIproductionEndpoint_0">
                            <http uri-template="http://localhost:8081/getAppsByName">
                                <timeout>
                                    <duration>30000</duration>
                                    <responseAction>fault</responseAction>
                                </timeout>
                                <suspendOnFailure>
                                    <errorCodes>-1</errorCodes>
                                    <initialDuration>0</initialDuration>
                                    <progressionFactor>1.0</progressionFactor>
                                    <maximumDuration>0</maximumDuration>
                                </suspendOnFailure>
                                <markForSuspension>
                                    <errorCodes>-1</errorCodes>
                                </markForSuspension>
                            </http>
                        </endpoint>
                    </send>
                </then>
                <else>
                    <sequence key="_sandbox_key_error_"/>
                </else>
            </filter>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
    </resource>
    <handlers>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler">
            <property name="id" value="A"/>
            <property name="policyKey" value="gov:/apimgt/applicationdata/tiers.xml"/>
        </handler>
        <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/>
        <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler">
            <property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
        </handler>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
    </handlers>
</api>

谢谢!

0 个答案:

没有答案