magento-1.7 - Mule Magento Cloud Connector 2.0,缺少变压器?

标签 magento-1.7 mule

编辑:已解决。在提出这个问题时,Magento Cloud Connector 太旧了,无法与 Magento 1.7 一起使用。


我正在尝试使用 magento 云连接器进行产品更新。我的 xml 如下所示:

<magento:update-product config-ref="testConfig" doc:name="Update Product" productSku="#[header:OUTBOUND:ProductId]">
    <magento:catalog-product-entity name="#[header:outbound:Name]">
    </magento:catalog-product-entity>
    <magento:additional-attributes>
        <magento:additional-attribute key="isbn" value-ref="#[header:OUTBOUND:ISBN]" />
        <magento:additional-attribute key="subject" value-ref="#[header:OUTBOUND:Subject]" />    
    </magento:additional-attributes>        
</magento:update-product>

尝试进行更新总是会导致以下异常:

Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".

完整的堆栈跟踪:

ERROR 2013-05-02 09:28:37,056 [[asdasd].httpConnector.receiver.05] org.mule.exception.CatchMessagingExceptionStrategy: 
********************************************************************************
Message               : Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".
Type                  : org.mule.api.transformer.TransformerException
Code                  : MULE_ERROR-236
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html
********************************************************************************
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}". (org.mule.api.transformer.TransformerException)
  org.mule.registry.MuleRegistryHelper:252 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)

 ********************************************************************************
Root Exception stack trace:
org.mule.api.transformer.TransformerException: Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "SimpleDataType{type=com.magento.api.AssociativeEntity, mimeType='*/*'}".
    at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
    at org.mule.module.magento.processors.AbstractExpressionEvaluator.transform(AbstractExpressionEvaluator.java:329)
    at org.mule.module.magento.processors.AbstractExpressionEvaluator.evaluateAndTransform(AbstractExpressionEvaluator.java:202)
    at org.mule.module.magento.processors.AbstractExpressionEvaluator.evaluateAndTransform(AbstractExpressionEvaluator.java:169)
    at org.mule.module.magento.processors.UpdateProductMessageProcessor.process(UpdateProductMessageProcessor.java:171)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:112)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
    at org.mule.construct.Flow$1.process(Flow.java:74)
    at org.mule.construct.Flow$1.process(Flow.java:69)
    at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
    at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
    at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:63)
    at org.mule.execution.ErrorHandlingExecutionTemplate.execute(ErrorHandlingExecutionTemplate.java:3...
********************************************************************************

和 xml:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:magento="http://www.mulesoft.org/schema/mule/magento" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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/magento http://www.mulesoft.org/schema/mule/magento/1.1/mule-magento.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
    <magento:config name="testConfig" username="username" password="password" address="wsdllocation" doc:name="Magento"/>  




    <flow name="push-products-to-magentoFlow1" doc:name="push-products-to-magentoFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="20008"  doc:name="HTTP" path="productsToMagento"/>

        <logger level="INFO" message="'#[header:OUTBOUND:ProductId]'" doc:name="Logger"/>
        <logger level="INFO" message="'#[header:OUTBOUND:Name]'" doc:name="Logger"/>

        <magento:get-product config-ref="testConfig" doc:name="Get Product"  productSku="#[header:OUTBOUND:ProductId]"> 
            <magento:attributes-names>
                 <magento:attributes-name>sku</magento:attributes-name>
            </magento:attributes-names>
        </magento:get-product>

        <logger message="******************* AFTER GET PRODUCT *********************" level="INFO" doc:name="Logger"/>

        <magento:update-product config-ref="testConfig" doc:name="Update Product" productSku="#[header:OUTBOUND:ProductId]">
        <magento:catalog-product-entity name="#[header:outbound:Name]" price="#[header:OUTBOUND:Price]">     
        </magento:catalog-product-entity>
            <magento:additional-attributes><!-- value-ref causes transformer exception? -->
                 <magento:additional-attribute key="isbn" value-ref="#[header:OUTBOUND:ISBN]" />
                 <magento:additional-attribute key="subject" value-ref="#[header:OUTBOUND:Subject]" />  
            </magento:additional-attributes>    
    </magento:update-product>
        <logger message="************** PRODUCT UPDATE SUCCESFULL ************" level="INFO" doc:name="Logger"/>
        <object-to-string-transformer doc:name="Object to String"/>
        <echo-component doc:name="Echo"/>    
    </flow>
</mule>

正如评论中所指出的,我认为问题出在附加属性 block 上,它试图将值从字符串转换为 AssociativeEntity ,但失败了。我不太确定定义附加属性的正确语法是什么,如 api示例没有定义其他属性。

编辑: 从 value-ref 更改为 value 解决了变压器问题,但没有解决我遇到的根本问题。连接器使用太旧的 wsdl,正如 Masse 在下面指出的那样。

最佳答案

在这种情况下,似乎 value-ref 不是正确使用的属性,而 value 就可以了。但这并不能解决问题,因为 magento-connector 中使用的 wsdl 已经过时了。

当前的 magento 连接器 wsdl 兼容 magento 1.5。 wsdl 于 2011 年 5 月生成,而 magento 在 2011 年 10 月修改了其 wsdl,添加了 single_data 字段。

因此,这背后真正问题的答案是,事实上,这是不可能完成的。 magento-connector插件需要更新、magento降级或者启用WS-I合规模式,这有其自身的缺点

关于magento-1.7 - Mule Magento Cloud Connector 2.0,缺少变压器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16297276/

相关文章:

javascript - Magento Varien JS 文件应该如何更改?

java - 如何将 Java HashMap 传递到自定义 Mule 连接器?

java - 在Mule中,我如何在不改变原始输出流的情况下记录http响应

php - 无法在Magento订单创建脚本中设置送货方式

javascript - 我在 magento 1 中面临文件验证大小的问题

php - 是否可以在 Magento 中更新订单商品数量?

Mule 如何将 Json 值从有效负载映射到流变量

jms - 骡子 ESB : Setup JMS Endpoint for WMQ Queue

mule - 我如何开始使用 (MuleSoft) Mule ESB

magento - 使用soap api 访问magento 中的图像。无法访问缩略图。需要调整图像大小