简体   繁体   English

wso2 esb drupal连接器

[英]wso2 esb drupal connector

I have been able to retrieve node data(from the Drupal rest service) using the WSO2 ESB Drupal connector, but while posting data(creating a node), it fails even though it shows response 200 using the rest client. 我已经能够使用WSO2 ESB Drupal连接器检索节点数据(从Drupal其余服务),但是在发布数据(创建节点)时,即使使用剩余客户端显示响应200也失败。 Drupal permissions have been set with anonymous rights for reading and creating node content. 已为Drupal权限设置了匿名权限,用于读取和创建节点内容。

Both the drupal application and the WSO2 ESB application are on my local machine. drupal应用程序和WSO2 ESB应用程序都在我的本地计算机上。

ESB URL 10.102.6.223:8280/services/drupal_createNode_jun21-333pm Drupal Rest API URL 10.102.6.223:8090/drupal/test1 ESB URL 10.102.6.223:8280/services/drupal_createNode_jun21-333pm Drupal Rest API URL 10.102.6.223:8090/drupal/test1

Data posted through the rest client: { "responseType":"json", "apiUrl": " http://10.102.6.223:8090/drupal/test1 ", "title": "test title213pmv2", "type": "article" } 通过其余客户端发布的数据:{“” responseType“:” json“,” apiUrl“:” http://10.102.6.223:8090/drupal/test1 “,” title“:”测试标题213pmv2“,” type“:”文章”}

WSO2 ESB Proxy service details: WSO2 ESB代理服务详细信息:

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="drupal_createNode_jun21-333pm" startOnLoad="true"
  trace="disable" transports="https http" xmlns="http://ws.apache.org/ns/synapse">
  <target>
    <inSequence onError="faultHandlerSeq">
      <sequence key="faultHandlerSeq"/>
      <property expression="json-eval($.responseType)"
        name="responseType" scope="default" type="STRING"/>
      <property expression="json-eval($.apiUrl)" name="apiUrl"
        scope="default" type="STRING"/>
      <property expression="json-eval($.title)" name="title"
        scope="default" type="STRING"/>
      <property expression="json-eval($.type)" name="type"
        scope="default" type="STRING"/>
      <drupal.init>
        <apiUrl>{$ctx:apiUrl}</apiUrl>
        <responseType>{$ctx:responseType}</responseType>
      </drupal.init>
      <drupal.createNode>
        <type>{$ctx:type}</type>
        <title>{$ctx:title}</title>
      </drupal.createNode>
      <respond/>
    </inSequence>
    <outSequence>
      <send/>
    </outSequence>
    <faultSequence/>
  </target>
</proxy>

Any pointers to get this working is much appreciated. 任何使该工作正常进行的指针都将受到赞赏。 Thanks. 谢谢。

I think you're missing nodeBody please use below format and try 我认为您缺少nodeBody,请使用以下格式并尝试

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="drupal_createNode" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
 <target>
 <inSequence onError="faultHandlerSeq">
  <property name="responseType" expression="json-eval($.responseType)"/>
  <property name="apiUrl" expression="json-eval($.apiUrl)"/>
  <property name="userName" expression="json-eval($.userName)"/>
  <property name="password" expression="json-eval($.password)"/>
  <property name="title" expression="json-eval($.title)"/>
  <property name="nodeBody" expression="json-eval($.nodeBody)"/>
  <property name="customFields" expression="json-eval($.customFields)"/>
  <property name="comment" expression="json-eval($.comment)"/>
  <property name="type" expression="json-eval($.type)"/>
  <drupal.init>
     <responseType>{$ctx:responseType}</responseType>
     <apiUrl>{$ctx:apiUrl}</apiUrl>
     <userName>{$ctx:userName}</userName>
     <password>{$ctx:password}</password>
  </drupal.init>
  <drupal.createNode>
     <title>{$ctx:title}</title>
     <nodeBody>{$ctx:nodeBody}</nodeBody>
     <customFields>{$ctx:customFields}</customFields>
     <comment>{$ctx:comment}</comment>
     <type>{$ctx:type}</type>
  </drupal.createNode>
   <respond/>
 </inSequence>
  <outSequence>
   <send/>
  </outSequence>
 </target>

and use request in below format 并使用以下格式的请求

{
"apiUrl": "http://172.22.217.40/restapi",
"userName": "samliyanage",
"password": "1qaz2wsx@",
"responseType": "json",
"title": "test title",
"nodeBody": {
    "und": [
        {
            "value": "bodyss textreee",
            "summary": "dffffffffffffff",
            "format": "filtered_html",
            "safe_value": "bodyss text",
            "safe_summary": "text"
        }
    ]
},
"customFields": {
    "field_des": "tiger tiger"
},
"comment": "testing",
"type": "article"
}

For more details here 欲了解更多详情点击这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM