Mulento连接器在Mule 3.5中

时间:2014-01-29 18:43:02

标签: magento mule

我尝试创建Megento连接器vedio链接中给出的Megento连接器示例程序。http://www.youtube.com/watch?v=GCbuqHLCiOg

我的流程是:

<magento:config name="MagentoConnector" username="${magento.username}" password="${magento.password}" address="${magento.address}" doc:name="Magento">
    <magento:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</magento:config>
<flow name="ShoppingCartOPerations" doc:name="ShoppingCartOPerations">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="shoppingCartOperation" doc:name="HTTP"/>
    <flow-ref name="CreateProduct" doc:name="Flow Reference"/>
    <set-payload value="Product Id is #[groovy:message.getProperty('productId')]" doc:name="Set Payload"/>
</flow>
<sub-flow name="CreateProduct" doc:name="CreateProduct">
    <magento:create-product config-ref="MagentoConnector" type="simple" set="1" sku="simple_sku" storeViewIdOrCode="4" doc:name="Create Product" address="https://sashistore.gostorego.com/api/v2_soap" password="gdskey" username="gdssrao">
        <magento:attributes name="SampleProduct" description="TestProduct" short_description="creating sample product" weight="100" status="1" visibility="4" price="100" tax_class_id="1"/>
    </magento:create-product>
    <set-property propertyName="productId" value="#[payload]" doc:name="Store Product id"/>
    <magento:update-inventory-stock-item config-ref="MagentoConnector" productId="#[groovy:message.getProperty('productId')]" doc:name="Update Stock">
        <magento:catalog-inventory-stock-item qty="33" is_in_stock="100" min_qty="10"/>
    </magento:update-inventory-stock-item>
</sub-flow>


ERROR 2014-01-29 23:48:48,521 [[magentotest] .connector.http.mule.default.receiver.02] org.mule.retry.notifiers.ConnectNotifier:无法连接/重新连接:工作描述符。 Root Exception为:null。键入:class org.mule.api.ConnectionException ERROR 2014-01-29 23:48:48,524 [[magentotest] .connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:

2 个答案:

答案 0 :(得分:0)

您已在magento:create-product中定义了纯文本连接属性(用户名,密码,地址),然后将它们作为magento:config中的应用程序属性。这并没有多大意义,因为当你在其他元素中使用config-ref时,你只需要定义一次属性(在config元素中)。由于您遇到连接失败,我猜您在config元素中有不正确的属性。尝试使用magento:create-product中的属性,而不是。

编辑:我检查了WSDL您的Magento API,似乎您的地址不正确

请尝试使用https://sashistore.gostorego.com/index.php/api/v2_soap/index/

EDIT2:我从the Magento documentation获得了Magento API v2的WSDL URL。有关如何从WSDL获取Web服务的地址的说明,请参阅this页面。

答案 1 :(得分:0)

<magento:config name="MagentoConnector" username="gdssrao" password="gdskey" address="https://sashistore.gostorego.com/api/v2_soap" doc:name="Magento">
    <magento:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</magento:config>
<flow name="ShoppingCartOPerationsFlow" doc:name="ShoppingCartOPerationsFlow">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="shoppingCartOperation" doc:name="HTTP"/>
    <logger level="INFO" doc:name="Logger"/>
    <flow-ref name="CreateProductFlow" doc:name="Flow Reference"/>
    <logger level="INFO" doc:name="Logger"/>
    <set-payload value="Product Id is #[groovy:message.getProperty('productId')]" doc:name="Set Payload"/>
</flow>
<sub-flow name="CreateProductFlow" doc:name="CreateProductFlow">
    <magento:create-product config-ref="MagentoConnector" type="simple" set="1" sku="simple_sku" storeViewIdOrCode="4" doc:name="Create Product">
    <magento:attributes name="SampleProduct" description="TestProduct" short_description="creating sample product" weight="100"  visibility="4" />
    </magento:create-product>
     <logger level="INFO" doc:name="Logger"/>
    <set-property propertyName="productId" value="#[payload]" doc:name="Store Product id"/>
    <logger level="INFO" doc:name="Logger"/>
    <magento:update-inventory-stock-item config-ref="MagentoConnector" productId="#[groovy:message.getProperty('productId')]" doc:name="Update Stock">
        <magento:catalog-inventory-stock-item   />
    </magento:update-inventory-stock-item>
</sub-flow>