2013-04-30 51 views
2

編輯:解決。在提出這個問題的時候,Magento雲連接器太老了,無法與Magento 1.7一起使用。Mule Magento雲連接器2.0,缺少變壓器?


我正在嘗試使用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> 

正如在紀念nts,我認爲問題出現在額外的屬性塊,它嘗試將字符串中的值轉換爲AssociativeEntity,但失敗。我不太確定定義附加屬性的正確語法是什麼,因爲api示例沒有定義附加屬性。

編輯: 從值裁判值更改解決了變壓器的問題,但不是根本的問題我有。連接器使用的老式wsdl與下面指出的Masse相同。

+0

什麼騾子和Magento的接口版本? – 2013-04-30 16:16:12

+0

Magento Connector 2.0,mule 3.4CE,magento 1.7 – Zavior 2013-05-01 06:14:37

+0

謝謝:你介意用'-M-Dmule.verbose.exceptions = true'運行Mule併發布完整的堆棧跟蹤?另外,'magento:update-product'元素之前/之後還有什麼? – 2013-05-01 16:22:26

回答

2

看來,如果在這種情況下值裁判是不使用正確的屬性,而不是值是確定的。但這並不能解決這種情況,因爲magento連接器中使用的wsdl已過時。

電流的magento連接器WSDL是magento的1.5兼容。 wsdl於2011年5月生成,而magento通過添加single_data字段修改了2011年10月的wsdl。

所以答案這背後真正的問題是,因爲它是,它無法做到的。 Magento的連接器插件需要更新,Magento的降級或支持WS-I兼容模式,它有其自身的缺點