2014-01-29 34 views
0

我已经尝试创建Megento连接器视频链接中给出的Megento连接器示例程序。 http://www.youtube.com/watch?v=GCbuqHLCiOgMagento Connector Mule 3.5

我的流程为:

<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年1月29日23:48:48521 [[magentotest] .connector.http.mule.default.receiver.02 ] org.mule.retry.notifiers.ConnectNotifier:无法连接/重新连接:工作描述符。根异常是:null。类型:class org.mule.api.ConnectionException 错误2014-01-29 23:48:48,524 [[magentotest] .connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:

回答

0

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

编辑:我检查了WSDL为你的Magento API,它似乎是你

使用https://sashistore.gostorego.com/index.php/api/v2_soap/index/尝试,而不是有不正确的地址。

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

+0

酷!它使用这个URL。您能否请我提供如何找到正确的URL。旧的URL也在Magento连接创建中工作,但在调用操作时失败? – GDSSRAO

+0

没有魔力,我只是检查了你的服务的WSDL,如Magento文档(https://www.magentocommerce.com/api/soap/introduction.html)中所述。 WSDL定义了一个“端口”(通常使用一个URL)在哪里发送SOAP调用。 –

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>