我想尝试使用来自http://www.mulesoft.org/connectors/drupal-connector的 Drupal 云连接器的示例。
但是当我去
http://localhost:8081/drupal/node/create?title=test
要创建一篇新文章,这是浏览器中的响应:
Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "CollectionDataType{type=java.util.List, itemType=java.lang.Object, mimeType='*/*'}".. Message payload is of type: String
这就是 MuleStudio 控制台的输出:
ERROR 2013-08-03 22:40:54,555 [[drupal-esb].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "CollectionDataType{type=java.util.List, itemType=java.lang.Object, mimeType='*/*'}".
Code : MULE_ERROR-236
--------------------------------------------------------------------------------
Exception stack is:
1. Could not find a transformer to transform "SimpleDataType{type=java.lang.String, mimeType='*/*'}" to "CollectionDataType{type=java.util.List, itemType=java.lang.Object, 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 "CollectionDataType{type=java.util.List, itemType=java.lang.Object, mimeType='*/*'}".
at org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
at org.mule.modules.drupal.processors.AbstractExpressionEvaluator.transform(AbstractExpressionEvaluator.java:329)
at org.mule.modules.drupal.processors.AbstractExpressionEvaluator.evaluateAndTransform(AbstractExpressionEvaluator.java:202)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
WARN 2013-08-03 22:40:54,819 [[drupal-esb].http.request.dispatch.8081.02] org.mule.transport.http.HttpConnector: No receiver found with secondary lookup on connector: connector.http.mule.default with URI key: http://localhost:8081/favicon.ico
WARN 2013-08-03 22:40:54,819 [[drupal-esb].http.request.dispatch.8081.02] org.mule.transport.http.HttpConnector: Receivers on connector are: {
http://localhost:8081/drupal/node/create=HttpMessageReceiver{this=1ea6cbb2, receiverKey=http://localhost:8081/drupal/node/create, endpoint=http://localhost:8081/drupal/node/create}
}
那在我的配置 XML 中:
<?xml version="1.0" encoding="UTF-8"?>
<mule ....>
<drupal:config name="Drupal" username="dba" password="****" server="locahost" apiUrl="/service/rest" taxonomyTermEndpoint="taxonomy-term" taxonomyVocabularyEndpoint="taxonomy-vocabulary" doc:name="Drupal" >
<drupal:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</drupal:config>
<flow name="drupal-esbFlow1" doc:name="drupal-esbFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" path="drupal/node/create"/>
<drupal:create-node config-ref="Drupal" doc:name="Drupal" password="****" username="dba">
<drupal:node title="#[message.inboundProperties['title']]" type="article">
<drupal:body>
<drupal:und ref="#[payload]"/>
</drupal:body>
</drupal:node>
</drupal:create-node>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>