WSO2 EI 最全操作手册

文章目录

学习前准备:
概念:
(1)SOA
(2)ESBog
(3)soap / wsdl / schema / xml 之间存在的关系
(4)rest
(5)代理

http://soatutorials.blogspot.com/2015/

WSO2简介

      WSO2 ESB是一个轻量级的易于使用的企业服务资源总au线,基于Apache Software License v2.0. WSO2 ESB 允许系统管理员和SOA架构师轻松的配置消息路由, 虚拟化, 中介, 转换, 日志记录, 任务调度, 负载均衡, 失败路由, 事件中介等等. 运行时被设计为完全异步, 非阻塞 、连续的。基于 Apache Synapse 中介引擎.  

备注:异步非阻塞态

      WSO2 ESB 4.0.3 在革命性的 WSO2 Carbon platform (Middleware a' la carte)上进行开发, 并基于 OSGi 以便能对面向服务的架构(SOA)提供更好的模块化和组件化 . 这个版本也包含了一些新的特性和可选的组件,可以使用他们来自定义服务。. 更近一步说,如果你不想使用任何内置的特性,你可以毫无顾虑的卸载他们. 换句话说, WSO2 ESB 可以被自定义和调整以适用与你自己的SOA需求

wso2体系结构

图片

     WSO2 ESB 支持许多应用层协议和消息协议 (统称为传输), 包括 HTTP/S, E-mail, Java 消息服务 (JMS) and 虚拟文件系统 (VFS). 他还支持域特定协议 如:金融信息交换 (FIX), 高级消息队列协议 (AMQP) and Health Layer 7 (HL7). 新的传输可以被很容易的插入到服务中,这点还得感谢Axis2 传输框架提供的无缝可扩展性.

     ESB 使用消息构建器组件来解析不通渠道的传输是如何到达的。. 一个消息构建器通常和内容类型联系在一起. 依靠到达消息的实际内容类型,ESB将会选择一个合适的消息构建器,然后解析这个消息的内容,根据XML信息集把它转化成Apache AXIOM. WSO2 ESB ships with 消息构建器处理文本消息 (纯文本, SOAP, POX 等) 还有二进制消息. 消息转换器是和构建器拥是功能相反的伙伴. 一个消息转换器会把消息根据原来的内容类型转换成原来的格式,在这个消息进入下次传输路由之前。.和传输一样,用户可以实现新的消息构建器和转换器通过使用Axis2 API.

      高级端点在传输中保持作为一个逻辑的单元,有三种类型的断点,即地址端点、WSDL端点和默认端点。除了这些之外还有第二种端点类型:负载均衡断点和失败端点,他们有一个或多个高级端点组成. 一种端点可以使用任何有效的传输去分派消息,他们甚至可以在传出消息上实施各种QoS 约束(安全, RM 等) .

代理服务是 WSO2 ESB代理的虚拟服务. 他是用 Axis2 消息接收器实现的 所以能轻松的接受到来的消息.一个代理服务可以用URL访问也可以用规范的Web服务地址. 代理服务也发布一个WSDL 所以客户端连接代理服务就像连接一个真是的Web服务. 任何可用的传输都可以用来接受和请求消息通过这个代理服务. 代理服务是一个NB的方式用来发布已经存在的服务通过不通的传输工具、模式和 QoS配置.

     WSO2的强大就在于他全方位的中介库,提供了各种消息处理和中介的功能. 使用这些中介库我们可以实现所有广泛应用的消息转化模式 (MEP)和企业集成模式(EIP). 存在简单的中介提供基本的消息处理功能如:日志记录和内容传输.也存在高级的中介用来访问数据库、对信息流添加安全等. 在这种情况下,内置的中介仍不足以满足一个方案,那么你可以依赖WSO2提供的简单但强大的API写一个自定义的中介.中介可以用多种技术来实现,包括java、脚本和spring。所有的这些都被认为是WSO2的扩展。

     序列是特殊的中介充当中介的配置组件。序列允许组织中介实现命令管道和过滤器模式来实现实际的消息处理和中介 .

     任务为WSO2 ESB 提供了配置计划任务的能力,他们为中介执行内部和外部的命令. QoS 组件 实现可靠消息、安全代理服务和中介,他和Apache的两个模块的实现都是为了 Axis2, 这两个模块是 Rampart 和 Sandesha.

WSO2 ESB 拥有内置的注册/存储库来存储配置和配置元数据 并且也提供了设备用来远程存储. 组件像集群、负载均衡和高可用性是WSO2成为了一个生产准备服务器。. 最后 GUI 组件提供了综合管理、配置和监视能力. GUI 建立在一个通过分离前端和后端的分层的架构上,. 这样就使得用户可以连接多个服务端通过一个 GUI控制台.这个基于WSO2的架构的组件提高了和OSGI之间的松耦合. 所有的这些组件都建立为 OSGi 包.

原文链接:https://blog.csdn.net/xo_zhang/article/details/9191617

https://download.csdn.net/download/fjxin999/5276627

http://blog.itpub.net/29063131/viewspace-2134263/

https://www.enterpriseintegrationpatterns.com/patterns/messaging/toc.html

WSO2学习和使用

安装

需要jdk环境

quick start: https://docs.wso2.com/display/EI650/Quick+Start+Guide#2f01d764300c4ec68ad108b2df435e2c

安装向导: https://docs.wso2.com/display/EI650/Installation+Guide

下载地址: https://wso2.com/integration/?src=sidebar

rpm包直接安装,解压之后默认的安装目录为/usr/lib64/wso2/wso2ei/6.5.0

常见问题:

(1)https://www.cnblogs.com/lbblogs/p/10321402.html

问题一: 将H2替换为Mysql5.7数据库时提示无法找到驱动

  **  解决方式:**官方文档给出的驱动程序位置有误,应为**<EI_HOME>/lib**,将5.7对应的驱动mysql-connector-java-8.0.14.jar存放在该目录,相应的dropins中也会复制一个驱动。

问题二:启动后与API Manager大量的端口冲突

** 解决方式:**因两款产品用到相同的技术手段,且大量的端口配置相同,因此部署在同一服务器时自然会冲突,如果一个一个查端口,再单独修改,工作量惊人,还好WOS2想到了该问题,只需要在启动EI时添加端口偏移量即可

    命令:./integrator.sh -DportOffset=3 (端口号均增加3)

问题三:修改完Mysql5.7提示连接不上

** 解决方式:类似于我另一篇博客,是数据库SSL问题,关闭即可**

问题四:启动后提示缺少WSO2 Indenty Server相关类库

** 原因:**与Api Manager采用了同样的数据库,但还没有部署同一的认证服务期,因此报错,解决方式:

     1)部署Wso2 IS(还没试)

     2)与AM不共用库

问题五:运行成功后,ServerIp为localhost

** **图片

** 参考文献:**https://docs.wso2.com/display/EI611/Configuring+carbon.xml

** (1) Host 显示不准确**

** 解决方法:修改…/conf/carbon.xml文件中的HostName,改为服务器的ip地址即可**

** 问题六:按照官方的教程**Sending a Simple Message to a Service运行 ,卡在运行msf4j.sh上,运行报错端口被占用。但坑爹的是****不告诉你哪个端口被占用。

** 解决方法:在google中搜索相关内容,找到了WSO2的所有端口信息https://docs.wso2.com/display/EI610/Default+ports+of+WSO2+EI 相关的端口可能是9090,在linux服务器上查询,发现有可能是gitlab的端口占用。查了一下午资料,试了端口offset不行,怀疑是服务jar包端口占用,删了也同样报错,后来终于发现9090端口的配置位置:/usr/lib64/wso2/wso2ei/6.4.0/wso2/msf4j/conf/transports/netty-transports.yml 即可。**

** 问题七:问题六改完后报新错:**

(1)同一个参数,被使用两次,报空指针

https://github.com/wso2/product-ei/issues/4558** 问题地址**

(2)在这里插入图片描述
图片中红线的IP地址位置,显示的不是IP,是hostname的时候,配置文件进行修改;

在这里插入图片描述
上图的角号位置的注释打开,并按照实际的IP,按照上图进行配置;

启动

sudo wso2ei-6.5.0-integrator

sudo nohup wso2ei-6.5.0-integrator >> /wso2_run.log 2>&1 &

window下启动 wso2home\bin下的integrator.bat 文件

关闭

ps -ef|grep wso2ei-6.5.0-integrator

kill -9 端口号

或者

sudo nohup wso2ei-6.5.0-integrator stop

访问地址

浏览器访问地址,会在启动控制台日志中体现,https://{IP}:9443/carbon

u:admin / p:admin

页面介绍

主页

图片

主要介绍WSO2引擎的安装目录,JVM目录,服务请求地址等;

监控

图片

配置

图片

应用

proxy service

代理服务充当了WSO2 ESB服务的代理,通常是一个已经存在的服务端点,代理服务可以使用不同的传输方式。

客户可以直接发送请求代理服务的ESB,客户看到服务代理。

选择一个与中介场景匹配的模板,或者创建一个完全定制的代理服务,以满足您的具体需求。

场景描述

对外提供soap webservice,通过esb代理 rest 服务,返回restful 服务的的响应数据给esb ,esb返回数据给请求方,流程如下图:

图片

rest-GET空参数请求开发流程

前期准备环境

需要提供restful 的服务地址,本机的开发环境服务地址;

URL:http://localhost:8181/person/

Headers:Content-Type application/xml

Method: GET

in param : 空的soap信封

out param:xml返回消息

ps:

图片

操作

(1)Mian 工具栏->Manage->services->Add-Proxy Service->Custom Proxy

(2)点击 source view,输入以下代码图片

具体代码:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="person"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <send>
            <endpoint key="HTTPEndpoint"/>
         </send>
         <log level="full"/>
      </inSequence>  
      <outSequence>
         <log level="full"/>
        <!-- 可以控制返回参数是否带有soap信封 -->
         <property name="messageType" scope="axis2" value="text/xml"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

(3)HTTPEndpoint

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
   <http uri-template="http://192.168.110.127:8181/person" method="get">
      <suspendOnFailure>
         <progressionFactor>1.0</progressionFactor>
      </suspendOnFailure>
      <markForSuspension>
         <retriesBeforeSuspension>0</retriesBeforeSuspension>
         <retryDelay>0</retryDelay>
      </markForSuspension>
   </http>
</endpoint>

实现结果

soapUI请求和响应:

图片

缓存数据控制周期

主要是用来说明缓存周期的控制范围
ScopeThe scope at which the property will be set or removed from. Possible values are as follows.
SynapseThis is the default scope. The properties set in this scope last as long as the transaction (request-response) exists.
TransportThe properties set in this scope will be considered transport headers. For example, if it is required to send an HTTP header named ‘CustomHeader’ with an outgoing request, you can use the property mediator configuration with this scope.
Axis2Properties set in this scope have a shorter life span than those set in the Synapse scope. They are mainly used for passing parameters to the underlying Axis2 engine
axis2-clientThis is similar to the Synapse scope. The difference between the two scopes is that the axis2-client scope can be accessed inside the mediate() method of a mediator via a custom mediator created using the Class mediator. For further information, see axis2-client.
OperationThis scope is used to retrieve a property in the operation context level.
RegistryThis scope is used to retrieve properties within the registry.
SystemThis scope is used to retrieve Java system properties.

rest-GET拼接参数请求开发流程

URL:http://localhost:8181/person/

Headers:Content-Type application/xml

Method: GET

in param : 空的soap信封

out param:xml返回消息

图片

具体代码如下

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="person_get"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="HTTP_METHOD" scope="axis2" value="GET"/>
		 <!-- value的值不能变,变动之后接收不到name的值 -->   
         <property name="messageType"
                   scope="axis2"
                   value="application/x-www-form-urlencoded"/>
         <log level="custom">
		 <!-- 获取XML请求消息体的属性值 -->   
            <property expression="$body/person/name" name="name"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://192.168.110.127:8181/person/get"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <log level="full"/>
         <property name="messageType" scope="axis2" value="text/xml"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>
                                
                                

soapUI请求和响应

图片

备注:接受的消息可以输多个参数,但是有效的参数值只有一个name值,其他的不进行的处理;

参考链接

(1)如何使用WSO2 ESB XPath检索整个XML元素而不是其文本值

(2)如何在SOAP消息有效负载内发送CDATA

http://blog.shelan.org/2013/03/how-to-send-cdata-inside-your-soap.html

需要加配置文件,这样在ESB中可以加cdata便签,并起作用

json取数据

图片

https://stackoverflow.com/questions/38615035/wso2-esb-api-to-soap-transformation

注:如果$1是个对象按截图获取,如果$1是字符串要加双引号包起来变成 {“Stock”:“$1”}

并且如果$1里有需要转义的字符前面要加\

可以写个js脚本处理一下

     var payload = mc.getPayloadJSON(); 

     var REQUEST_JSON = payload.REQUEST_JSON;  

     REQUEST_JSON = REQUEST_JSON.replace(/\"/g,"\\\\\\\"");

     payload.REQUEST_JSON = REQUEST_JSON;

     mc.setPayloadJSON(payload);

JS脚本相关操作

获取日志

var log = mc.getServiceLog();

log.info(“Logging inside Script Mediator”);

获取JSON消息体内容

var payload = mc.getPayloadJSON();

var arr = mc.getPayloadJSON().order_list.order;

备注:如果文本中含有/r /n 等特殊字符,需要将其替换或者删除,才能进行,不然JavaScript中会出现

图片

图片

将处理的消息封装到相应的标签下

payload.order_list.order = dest;
mc.setPayloadJSON(payload);

生成验证码

log.info("************"+Math.random().toString(36).substring(3,7)) ; 
log.info("************"+Math.floor(Math.random()*4000+1000)) ;   

获取XML消息体内容

字符串拼接

https://stackoverflow.com/questions/43397626/how-to-use-apostrophe-character-in-the-fnconcat-property-expression-wso2-esb

Switch标签的使用

https://medium.com/@harshan.dll/wso2-ei-using-switch-mediator-e421ed344efb

<sequence xmlns="http://ws.apache.org/ns/synapse" name="dynamic-route-seq">
   <switch source="get-property('To')">
      <case regex=".*/posts.*">
          <header name="To" value="http://jsonplaceholder.typicode.com/data"/>
      </case>
      <case regex=".*/comments.*">
          <header name="To" value="http://jsonplaceholder.typicode.com/data"/>
      </case>
      <case regex=".*/albums.*">
          <header name="To" value="http://jsonplaceholder.typicode.com/data"/>
      </case>
      <case regex=".*/photos.*">
          <header name="To" value="http://www.jsonplaceholder.typicode.com/users/photos"/>
      </case>
      <default>
          <header name="To" value="http://jsonplaceholder.typicode.com"/>
      </default>
   </switch>
</sequence>

获取CDATA标签内的数据

<property name="res_msg" xmlns:ns2="http://service.system.modular.javaplat.zhicheng.com" expression="$body//ns2:HIPMessageServer2Response/return" type="OM"/>
<!-- <property name="ID_VALUE" expression="get-property('res_msg')/@id"/> -->
<property name="ID_VALUE_1" expression="get-property('res_msg')//*[local-name()='acknowledgement']/@typeCode"/>

https://stackoverflow.com/questions/42555725/wso2-esb-5-0-how-to-recover-value-xml-element-into-cdata-section

获取时间

<property name="date" expression="get-property('SYSTEM_DATE', 'yyyy-MM-dd')" scope="default"/>
<property name="date" expression="get-property('SYSTEM_DATE', 'yyyy-MM-dd HH:mm:ss')" scope="default"/>

## 获取IP

       <property expression="get-property('axis2', 'REMOTE_HOST')" name="client-host"/>
         <property expression="get-property('axis2', 'REMOTE_ADDR')" name="client-add"/>
         <log level="custom">
            <property expression="get-property('client-add')" name="REMOTE_ADDR :"/>
            <property expression="get-property('client-host')" name="REMOTE_HOST:"/>
         </log>

图片

https://wso2.com/library/blog-post/2013/10/wso2-esb-balance-sugarcrm-proxy-service/

判断filter-then-else

<filter source="boolean(get-property('yourProperty'))" regex="true">
    <then>
           <!-- EXIST -->
    </then>
    <else>
           <!-- NULL OR NON EXIST -->
    </else>
</filter>

备注:多个条件则用and /or进行拼接,也支持><等符号操作

获取UUID

  <log level="custom">
			<property name="MessageID" expression="fn:substring-after(get-property('MessageID'), 'urn:uuid:')"/>
         </log>

get-property(‘MessageID’) 是可以直接获取UUID,但是获取的UUID会有前缀urn:uuid: ,fn:substring-after(),函数是用来去掉前缀的。

替换字符串函数

修改 <ESB_HOME>/conf 文件夹下的synapse.properties文件:

Uncomment following to support fallback XPATH 2.0 support with DOM and Saxon

synapse.xpath.dom.failover.enabled=true

<property xmlns:fn="http://www.w3.org/2005/xpath-functions" name="message_id" expression="fn:replace($ctx:uuid,'-','')"/>

$ctx是XPATH下使用的函数;fn:replace 是xpath的函数;

备注:如果$ctx: 要获取的值在标签里面的话,则获取不到数据;

拼接字符串

图片

<property name="symbol"
	expression="fn:concat("Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
	xmlns:m0="http://services.samples/xsd"/>

https://docs.wso2.com/display/ESB480/Property+Mediator

获取消息体内容(带有ns)

例如:

 <ns2:serviceInformationResponse xmlns:ns2="http://service.system.modular.javaplat.zhicheng.com">
         <return><![CDATA[<HIPServiceInformationResponse xmlns="urn:hl7-org:v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<id root="2.16.156.10011.0" extension="DDD34F6E-2E89-435A-9A62-F4CD3D4DE23B"/>
<creationTime value="20070803130624"/>
<name value="XXX 区域卫生信息平台"/>
<publisher value="XXX 公司"/>
<version value="V1.0"/>
<standardVersion value="WST448-2014"/>
<implementService>
<service value="AddPatientRegistry"/>
<service value="UpdatePatientRegistry"/>
<service value="MergePatientRegistry"/>
<service value="PatientRegistryQuery"/>
</implementService>
</HIPServiceInformationResponse>]]></return>
      </ns2:serviceInformationResponse>

获取ns2:serviceInformationResponse这个节点的内容,需要在 property 中加xmlns,样例如下:


  <log level="custom" >
		  <property xmlns:ns2="http://service.system.modular.javaplat.zhicheng.com" expression="$body//ns2:serviceInformationResponse/return" name="response"/>	 
		 </log>

WSDL Based Proxy

参考资料:

http://kukusan-network.blogspot.com/2012/10/how-to-create-web-service-proxy-in-esb.html

操作编码

操作1:图片

操作2:

图片

proxy service name:填写代理服务的名称,根据业务自定义

wsdl uri:被代理的wsdl地址;例如:http://192.168.1.1:8081/cxf/server?wsdl

地址为交互服务地址,直接请求的结果如下:

图片

wsdl Service:填写被代理的服务名称,样例如图所示:

图片

wsdl prot:填写被代理的port名称,样例如图所示:

图片

代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="base_service"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <wsdl port="DemoServiceImplPort"
               service="DemoService"
               uri="http://192.168.1.1:8081/cxf/server?wsdl"/>
      </endpoint>
   </target>
   <publishWSDL preservePolicy="false" uri="http://192.168.1.1:8081/cxf/server?wsdl"/>
   <description/>
</proxy>
                                

实现结果

图片

应用场景

应用在已经存在soap服务,我们esb需要做的就是网关代理,对外暴露请求服务地址,同时,可以对请求和响应的地址进行记录,操作等;

满足使用text/html

esb_home/conf/axis2/axis2.xml中添加:

<messageFormatter class="org.wso2.carbon.relay.ExpandingMessageFormatter" contentType="text/html"/>
<messageBuilder class="org.wso2.carbon.relay.BinaryRelayBuilder" contentType="text/html"/>

判断拦截器

参考书

https://stackoverflow.com/questions/15000596/using-xpath-functions-in-filter-mediator

http://shriwithjava.blogspot.com/2015/07/how-to-use-filter-mediator-in-wso2-esb.html

https://stackoverflow.com/questions/51164667/wso2-esb-filter-check-null-for-get-property

操作

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TestFilter"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <log level="custom">
            <property expression="//user" name="symbol"/>
			<property expression="$body//*[local-name()='name']/text()"
name="name" scope="default" type="STRING"/>
         </log>
         
         <property name="messageType" scope="axis2" value="text/xml"/>
     <filter xpath="//role='admin'">
   <then>
      <log level="custom">
         <property name="propStatus" value="role is available" />
      </log>
      <property name="userRole" expression="//role" regex="admin"/>
   </then>
   <else>
      <log level="custom">
         <property name="propStatus" value="!!!!role is not available!!!!" />
      </log>
      <property name="userRole" value="generic_user" />
   </else>
</filter>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <faultSequence/>
   </target>
   <description/>
</proxy>

结果展示

图片

rest-POST请求开发流程

场景描述

请求的rest服务是post的提交方式

URL:http://localhost:8181/person/add

Headers:Content-Type application/xml

Method: POST

in param : 空的soap信封

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
<person>
    <age>23</age>
    <name>wq</name>
    <sex>male</sex>
</person>
   </soapenv:Body>
</soapenv:Envelope>

out param:xml返回消息

接收的内容一致

具体步骤

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="person_add"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="ContentType" scope="axis2" type="STRING" value="text/xml"/>
         <property name="HTTP_METHOD" scope="axis2" type="STRING" value="POST"/>
         <log level="full"/>
         <send>
            <endpoint>
               <address format="pox" uri="http://192.168.110.127:8181/person/add"/>
            </endpoint>
         </send>
         <log level="full"/>
      </inSequence>
      <outSequence>
         <log level="full"/>
         <!-- 返回json数据-->
<!-- <property name="messageType" value="application/json" scope="axis2" type="STRING"/> -->         
<property name="messageType" scope="axis2" value="text/xml"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>
                                

遇到问题

问题1:确保在postman中请求的restful服务地址是有效的,入参可以是xml,json.XML消息样例需要root节点如下;

<person>
    <age>23</age>
    <name>zyan</name>
    <sex>male</sex>
</person>

json样例如下:

{
    "age": "23",
    "name": "zyan",
    "sex": "male"
}

问题2:请求无参数的rest,直接在proxy services中的Endpoint中配置地址,请求失败,在Endpoints中添加http endpoint,则可以调式通过;具体原因没有找到;

图片

问题3:

参考地址

https://code-examples.net/en/q/d5702a

https://www.chakray.com/wso2-esb-tutorial-simple-message-content-based-routing-using-filter-mediator/

https://www.cnblogs.com/leolzi/p/10966698.html?tt_from=weixin&utm_source=weixin&utm_medium=toutiao_ios&utm_campaign=client_share&wxshare_count=1

https://docs.wso2.com/display/EI650/Using+REST+with+a+Proxy+Service#UsingRESTwithaProxyService-RESTClientandSOAPService

https://docs.wso2.com/display/EI640/DB+Report+Mediator

代理SOAP协议

操作

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="StockQuoteProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <header name="Action" scope="default" value="serviceInformation"/>
         <log level="custom">
            <property expression="//arg0" name="symbol"/>
         </log>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:ser="http://service.system.modular.javaplat.zhicheng.com">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <ser:serviceInformation>
                        <arg0 xmlns=""><![CDATA[        $1]]></arg0>
                     </ser:serviceInformation>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="//arg0" literal="true"/>
<arg evaluator="xml" expression="//arg0/person/sex" literal="true"/>
            </args>
         </payloadFactory>
         <property name="messageType" scope="axis2" value="text/xml"/>
         <send>
            <endpoint>
               <address format="soap11" uri="http://192.168.1.1:8081/cxf/service/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <faultSequence/>
   </target>
   <description/>
</proxy>
                                

参考地址

(1)不使用wso2 ESB REST API发送SOAP消息

(2)[WSO2 EI]-丰富[CDATA []]内部的有效负载

https://medium.com/hasithas-tech-blessings/wso2-ei-enrich-payload-inside-cdata-574a8c2b671c

备注:

(1)入参为:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/> 
  <soapenv:Body> 
     <arg0> 
<![CDATA[ <HIPServiceInformation xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id root="2.16.156.10011.0" extension="DDD34F6E-2E89-435A-9A62-F4CD3D4DE23B"/>
  <creationTime value="20070803130624"/>
</HIPServiceInformation> ]]>
     </arg0> 
  </soapenv:Body> 
</soapenv:Envelope>

取参数的位置为//agr0
(2)使用payloadFactory mediator组件封装消息,进行重新发送的时候,需要

  1. create a file called XMLInputFactory.properties inside <EI_HOME>
  2. add following content into the file
    javax.xml.stream.isCoalescing=false

创建文件XMLInputFactory.property在引擎目录的根目录下,文件中填加

javax.xml.stream.isCoalescing=false

If you invoke the proxy with any SOAP message, you will get a malformed response. The reason for this is WSO2 EI uses STAX parser and by default, the STAX parser is in non coalescing mode. To correct that, you need to do following

API 服务

POST请求返回JSON数据

参考地址

https://medium.com/@arunans23/iterate-over-json-payload-with-wso2-enterprise-integrator-8ccb9cdd2c70

https://buddhimawijeweera.wordpress.com/2019/07/23/wso2-ei-support-for-iterate-and-enrich-json-payloads/

https://stackoverflow.com/questions/28572800/how-to-implement-a-dummy-rest-api-in-wso2-esb

<api xmlns="http://ws.apache.org/ns/synapse" name="hip_medical" context="/medical">
   <resource methods="POST" uri-template="/list">
      <inSequence>
         <send>
            <endpoint>
               <http method="POST" uri-template="http://192.168.140.232/ds/pub/jycfts?app=ed6ba99d776c4ffdaf12161cf9004450&amp;mod=znts&amp;org=e4fac59d6fcb4be9905865a5f59534b6"/>
               <!--  
                  <http method="POST" uri-template="http://localhost:8181/resource/list"/> -->
                  <!--
                     <http method="POST" uri-template="http://localhost:8181/person/json_add"/>-->
                  </endpoint>
               </send>
               <property name="messageType" value="application/json" scope="axis2" type="STRING"/>
            </inSequence>
         </resource>
      </api>
                        

备注:不能加outSequence,否则针对返回的字符串,不会有输出内容,json对象返回,可以操作。具体内容查看–员工信息列表-bat.xml

获取地址栏数据

例如:

/dictionary/{char}/{word}

取值:

<log level="custom">
   <property name="Character" expression="get-property('uri.var.char')"/>
   <property name="Word" expression="get-property('uri.var.word')"/>
</log>

?拼接参数的情况,获取参数:

/list?sfzjhm=370224195601235728

获取地址栏的参数,请求另外的接口,获取数据:

<property name="uri.var.id"  expression="$ctx:query.param.sfzjhm"/>

举例;

<send>
  <endpoint>
    <http method="GET" uri-template=
    "http://10.20.127.201:8280/services/rhip/list/{uri.var.id}" />
  </endpoint>
</send>

API调用DSS

1.http协议例子:该例子为调用两个DSS示例

     <endpoint>

        <recipientlist>

        <endpoint>

           <http method="POST" uri-template="http://10.20.127.201:8280/services/rhip_log/module_call_log_param/save"/>

        </endpoint>

        <endpoint>

           <http method="POST" uri-template="http://10.20.127.201:8280/services/rhip_log/module_call_log/save"/>

        </endpoint>

        </recipientlist>

     </endpoint>

2.如果参数有变动则调用前重新组装payload

   <payloadFactory media-type="json">

        <format>     {"MODULE_CODE": "$1"}</format>

        <args>

           <arg literal="true" evaluator="json" expression="$.MODULE_CODE"/>

        </args>

   </payloadFactory>

3.注意事项:

设置messageType

如果DSS没有返回则API会一直等待响应所以加如下设置

  <property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>

        <header action="remove" name="Content-Length" scope="transport"/>

        <header action="remove" name="Accept-Language" scope="transport"/>

        <header action="remove" name="Accept-Encoding" scope="transport"/>

        <header action="remove" name="User-Agent" scope="transport"/>

        <header action="remove" name="Content-Type" scope="transport"/>

        <header action="remove" name="Transfer-Encoding" scope="transport"/>

访问数据库

场景描述

通过服务请求,获取数据库信息,并封装xml消息体返回;

具体操作步骤

(1)将驱动程序放在<EI_HOME>/lib,(确保<EI_HOME>/dropins中没有其他的相关驱动包,不然会有冲突)最新的目录就够,老版本放在/repository/components/lib。

(2)编码如下:

图片

图片

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="database_get"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
       <inSequence>
         <dblookup>
            <connection>
               <pool>
                  <driver>com.mysql.cj.jdbc.Driver</driver>
                  <url>jdbc:mysql://192.168.140.229:33066/test</url>
                  <user>test</user>
                  <password>test</password>
               </pool>
            </connection>
            <statement>
               <sql>SELECT emp_name from emp</sql>
               <result name="emp_name" column="emp_name"/>
            </statement>
         </dblookup>
		 <!-- 控制台日志输出 -->
         <log level="custom">
            <property name="emp_name" expression="get-property('emp_name')"/>
         </log>
		 <!-- 设置输出的消息体的格式,不配置输出是空字符串-->
         <payloadFactory media-type="xml">
            <format>               <emp_name>$1</emp_name>            </format>
            <args>
               <arg evaluator="xml" expression="get-property('emp_name')"/>
            </args>
         </payloadFactory>
         <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
		 <!-- value="text/xml 则输出的消息体带信封格式,value="application/xml,输出的消息体不带信封-->
         <property name="messageType" value="text/xml" scope="axis2" type="STRING"/>
         <respond/>
      </inSequence>
      <faultSequence/>
   </target>
   <description/>
</proxy>
                                

(3)结果展示
图片

插入数据到数据

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="database_insert"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <dbreport>
            <connection>
               <pool>
                  <driver>com.mysql.cj.jdbc.Driver</driver>
                  <url>jdbc:mysql://192.168.140.229:33066/test</url>
                  <user>test</user>
                  <password>test</password>
               </pool>
            </connection>
            <statement>
               <sql>INSERT INTO emp VALUES(?,?,?,?)</sql>
               <parameter expression="$body/person/id" type="NUMERIC"/>
               <parameter expression="$body/person/name" type="VARCHAR"/>
               <parameter expression="$body/person/gender" type="VARCHAR"/>
               <parameter expression="$body/person/age" type="NUMERIC"/>
            </statement>
         </dbreport>
         <log level="custom">
            <property expression="$body/person/name" name="emp_name"/>
         </log>
         <payloadFactory media-type="xml">
            <format>
               <emp_name>true</emp_name>
            </format>
            <args/>
         </payloadFactory>
         <property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
         <property name="messageType" scope="axis2" type="STRING" value="text/xml"/>
         <respond/>
      </inSequence>
      <faultSequence/>
   </target>
   <description/>
</proxy>
                                

结果展示

图片

备注:
(1)需要用dbreport,否则报错,如下图:

图片

(2)参数的顺序和SQL的?顺序要一致
(3)主键自增,mysql按照mysql insert的语句主键列null就可以;
图片
主键自增操作

<dbreport useTransaction="false">
            <connection>
               <pool>
                  <driver>com.mysql.cj.jdbc.Driver</driver>
                  <url>jdbc:mysql://192.168.140.229:33066/test</url>
                  <user>test</user>
                  <password>test</password>
               </pool>
            </connection>
            <statement>
               <sql><![CDATA[INSERT INTO emp (emp_name,age,gender) VALUES(?,?,?)]]></sql>
                         <parameter expression="$body/person/name" type="VARCHAR" value="emp_name"/>
						   <parameter expression="$body/person/age" type="NUMERIC" value = "age"/>
                         <parameter expression="$body/person/gender" type="VARCHAR" value = "gender"/>       
            </statement>
         </dbreport>

参考网址
(1)A sample on a WSO2 ESB proxy with a DBLookup mediator and a dedicated faultSequence to excute during an error

(2) Apache Synapse/WSO2 API No response

(3)wso2 ESB查询数据库:https://www.youtube.com/watch?v=_iDHzpD2Cwk&t=196s

(4) WSO2 EI-插入数据库限制-DBReport介体-WSO2 EI - Insert to Database Restrictions - DBReport Mediator

(5)DB Report Mediator

(6)主键自增 https://docs.wso2.com/display/DSS321/Returning+Generated+Keys

(7)https://docs.wso2.com/display/ESB500/Sample+360%3A+Introduction+to+DBLookup+Mediator

https://stackoverflow.com/questions/52376396/wso2-ei-insert-to-database-restrictions-dbreport-mediator/52376425

获取接口数据写入数据

操作

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="log_save"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <property name="HTTP_METHOD" scope="axis2" value="GET"/>
         <property name="messageType"
                   scope="axis2"
                   value="application/x-www-form-urlencoded"/>
         <log level="custom">
            <property expression="$body/person/name" name="name"/>
         </log>
         <send>
            <endpoint>
               <address uri="http://192.168.110.127:8181/person/get"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <log level="custom">
            <property expression="$body/person/name" name="name"/>
            <property expression="$body/person/age" name="age"/>
            <property expression="$body/person/sex" name="gender"/>
         </log>
         <dbreport>
            <connection>
               <pool>
                  <driver>com.mysql.cj.jdbc.Driver</driver>
                  <url>jdbc:mysql://192.168.140.229:33066/test</url>
                  <user>test</user>
                  <password>test</password>
               </pool>
            </connection>
            <statement>
               <sql>INSERT INTO emp (emp_name,age,gender) VALUES(?,?,?)</sql>
               <parameter expression="$body/person/name" type="VARCHAR"/>
               <parameter expression="$body/person/age" type="BIGINT"/>
               <parameter expression="$body/person/sex" type="VARCHAR"/>
            </statement>
         </dbreport>
         <property name="messageType" scope="axis2" value="text/xml"/>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>
                                

结果

(1)请求和响应结果

图片

(2)数据库写入结果

图片

json和XML解析

备注:直接在property中获取数据的方式如下图:

图片

定时任务

场景描述

具体步骤

参考地址

(1)添加和计划任务

(2)Writing a simple scheduling task with WSO2 ESB 4.8.0

https://docs.wso2.com/display/EI650/Scheduling+Tasks

消息体映射

场景描述

具体步骤

参考地址

(1)WSO2 ESB Data Mapper : Getting Started with Data Mapper mediator

(2)https://medium.com/@eranda/wso2-esb-data-mapper-getting-started-with-data-mapper-mediator-99120a80bad8

(3)https://docs.wso2.com/display/EI650/Data+Mapper+Mediator

(4)https://docs.wso2.com/display/EI600/Transforming+Message+Content#TransformingMessageContent-Creatingthedeployableartifacts

推送消息到kafka

支持AMQP和JMS协议

参考地址:

Configuring the Kafka Inbound Operation

配置内置数据源

(1)导入数据库连接包 到<esb_home>/lib和<esb_home>/dropins中;

(2)修改配置文件<esb_home> /conf/datasources 的 master-datasources.xml配置文件

参考地址:

(1)[MySql 5.7] DM DB给出了错误的脚本(同时带有手动和-Dsetup)

(2)Remote Instance and Mount Configuration Details

(3)将远程存储库(WSO2 GREG)安装到WSO2 ESB

(4)https://malalanayake.wordpress.com/2013/01/08/database-configuration-in-wso2-carbon-products/

**(5)WSO2 Identity Server中的多用户存储配置

参考样例集合:

https://svn.wso2.org/repos/wso2/tags/wsf/cpp/1.0.0/esb/java/modules/distribution/src/main/docs/ESB_Samples.html

分析面板

前期准备

(1)安装JDK,并配置JDK环境变量;

(2)安装WSO2 EI 环境,解压就能用;

(3)从这里下载MSF4J服务并将JAR文件复制到<EI_HOME>/wso2/ MSF4J /deployment/microservices文件夹。后端服务现在部署在WSO2 EI的MSF4J配置文件中。

(4)如果运行在Windows上,从这里下载snappy-java_1.1.1.7.jar并将JAR文件复制到<EI_HOME>\lib目录。

设置分析统计

在/conf/synapse中设置以下属性。属性文件为true,以便ESB配置文件可以发布中介统计信息:

mediation.flow.statistics.enable=true
mediation.flow.statistics.tracer.collect.payloads=true
mediation.flow.statistics.tracer.collect.properties=true

启动服务

(1)启动分析配置文件:

<EI_HOME>/wso2/analytics/bin 目录下:

win:worker.bat
linux:sh worker.sh
nohup ./worker.sh > /wso2log/analytics_worker.log 2>&1 &

(2)启动后端服务 (which is an MSF4J service)

<EI_HOME>/wso2/msf4j/bin 目录下:

linux:sh carbon.sh
nohup ./carbon.sh > /wso2log/analytics_carbon.log 2>&1 &
win:carbon.bat

(3)开启集成引擎服务

<EI_HOME>/bin 目录下:

win:integrator.bat
linux:sh integrator.sh
nohup ./integrator.sh
nohup ./integrator.sh > /wso2log/integrator.log 2>&1 &

(4)开启统计消息和消息跟踪

图片

分析统计流转消息

(1)启动分析面板

<EI_HOME>/wso2/analytics/bin 目录下:

win:dashboard.bat
linux:sh dashboard.sh
nohup ./dashboard.sh > /wso2log/dashboard.log 2>&1 &

(2)登录连接

https://localhost:9643/portal

admin/admin

图片

图片

其他功能需要详细了解

图片

监控的端点

wso2 5.0 启动

(1)先启动<EI_HOME>/wso2/analytics/bin下的dashboard.bat,Linux下启动dashboard.sh。

在<EI_HOME>/bin下启动analytics-dashboard.bat或analytics-dashboard.sh。

(2)启动ESB服务

(3)根据启动日志页面访问,就可以看到分析面板

备注:
(1)ESB关闭,analytics-dashboard服务开启,可以访问页面,数据不刷新;
(2)ESB开启,analytics-dashboard服务关闭,esb报错,ssl 7712端口拒绝连接(启动顺序很重要),analytics-dashboard服务重启,历史数据依然存在;

问题:

(1)报错找不到ORG_… table,解决办法如下网址:将固定的jar包放到指定的位置上

https://stackoverflow.com/questions/39228454/wso2-esb-analytics-errors-after-access-dashboard

(2)warn: 图片

未解决

参考地址

(1)Using the Analytics Dashboard

(2)https://docs.wso2.com/display/EI650/Using+the+Analytics+Dashboard#a4c2b02871fa4aa3939026751c7deca0

ide服务设置

Starting the Integrator runtime and deploying the artifacts

缓存组件使用

How to use Cache Mediator in WSO2 ESB

https://stackoverflow.com/questions/25286736/querying-the-cached-response-in-wso2-dss-esb

集群配置

(1) https://stackoverflow.com/questions/18894171/wso2-esb-clustering-concept

(2)https://medium.com/@maryamzi/wso2-ei-clustering-the-esb-integration-profile-on-a-single-machine-dab84e787be9

(3)http://soatutorials.blogspot.com/2013/11/how-to-configure-wso2-esb-cluster-with.html

(4)Clustering the ESB Profile

汉化

https://gitee.com/kimmking/wso2esbcn

用Google浏览器访问,然后右键点击将页面翻译成中文。

跳过CSRF保护

参考:

https://docs.wso2.com/display/IS510/Mitigating+Cross+Site+Request+Forgery+%28CSRF%29+Attacks

https://medium.com/@PrakhashS/overview-cross-site-request-forgery-csrf-recommended-approach-for-wso2-products-bb0e2437307

**** https://docs.wso2.com/display/AM210/Adding+Internationalization+and+Localization

API客户端访问跨域

http://quabr.com:8182/56698539/wso2-api-manager-api-authentication-failure-for-multiple-scope

<api xmlns="http://ws.apache.org/ns/synapse" name="_WSO2AMTokenAPI_" context="/token">
    <resource methods="POST" url-mapping="/*" faultSequence="_token_fault_">
        <inSequence>
            <property name="uri.var.portnum" expression="get-property('keyManager.port')"/>
	    <property name="uri.var.hostname" expression="get-property('keyManager.hostname')"/>
            <send>
                <endpoint>
                     <http uri-template="https://{uri.var.hostname}:{uri.var.portnum}/oauth2/token">
                        <timeout>
                            <duration>60000</duration>
                            <responseAction>fault</responseAction>
                        </timeout>
                    </http>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
    </resource>
    <handlers>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
            <property name="apiImplementationType" value="ENDPOINT"/>
            <property name="allowHeaders" value="authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction"/>
            <property name="allowedOrigins" value="*"/>
            <property name="AuthorizationHeader" value="Authorization"/>
            <property name="allowedMethods" value="GET,PUT,POST,DELETE,PATCH,OPTIONS"/>
            <property name="allowCredentials" value="true"/>
        </handler>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerCacheExtensionHandler"/>
        <handler class="org.wso2.carbon.apimgt.gateway.handlers.common.SynapsePropertiesHandler"/>
    </handlers>
</api>

查询多条记录

https://github.com/ichakios/dbselect-wso2-mediator

http://cn.voidcc.com/question/p-mwxslzam-m.html

https://suhan-opensource.blogspot.com/2016/08/using-wso2-dss-retrieve-data-from.html

https://stackoverflow.com/questions/16263136/wso2-esb-dblookup-mediator-query-multiple-rows

解决uri参数中&转义的问题

https://developer.jboss.org/groups/jbugcz/blog/2012/07/29/unexpected-character-code-61-expected-a-semi-colon-after-the-reference-for-entity

https://susankhanirmala.wordpress.com/2016/04/20/how-to-appending-a-context-and-query-string-parameters-to-the-target-rest-endpoint-using-wso2-esb/

wso2文件夹之间的对比

图片

DSS配置

数据集成是集成过程的重要组成部分。例如,考虑以下情形,在该情形下,您具有使用WSO2 EI的ESB配置文件管理的典型集成过程。在这种情况下,需要使用存储在各种不同数据源中的数据来完成集成用例。 ESB概要文件中嵌入的数据服务功能允许您通过将数据与数据源层分离并将它们作为数据服务公开来管理此集成方案。然后,ESB中定义的主要集成流程将具有通过数据服务管理数据的能力。定义数据服务后,您可以通过调用数据服务中定义的相关操作来操纵存储在数据源中的数据。例如,您可以执行基本的CRUD操作以及其他高级操作。

1、需要多数据源的数据进行集成处理的情况;

2、遍历数据库的集合,针对集合进行操作的情况;

参考资料

https://docs.wso2.com/display/EI650/Exposing+a+Custom+Datasource+as+a+Data+Service#ExposingaCustomDatasourceasaDataService-Connectingtothedatasource

https://docs.wso2.com/display/EI650/Datasource+Configuration+Parameters

https://docs.wso2.com/display/EI650/Exposing+a+Datasource+as+a+Data+Service

https://docs.wso2.com/display/EI640/Elements+of+a+Data+Service

操作

创建DSS

(1)点击 services ->data service -> Create

图片

(2)必填 data Service Name ,根据业务自定义,其他默认,点击next

图片

添加数据源

(3)点击添加数据源

图片

(4)如图

图片

datasource id :根据具体业务自定义,要细化到当前执行sql的含义;

datasourceType :选择数据资源类型,可以选择表格,MongoDB,等;自定义关系型数据库类型,选择 RDBMS;

图片

选择RDBMS之后如图:

图片

Database Engine:可选择多种数据库类型;

选择oracle为例,配置驱动,url,数据库用户名和密码;

图片

Datasource configuration parameters ,这个窗体可以配置数据库连接池相关的内容,例如最大连接数,初始化连接数等;

具体样例如下:

图片

其他默认,有需要的,可以自行查询;其他的配置含义未进行确认含义;

配置结束,图片,测试数据源,并保存;

Dynamic User Authentication,这个功能未研究;

添加查询

(1)点击 add new query

图片

(2)

Query ID 结合业务命名,直接命名符合sql含义的名字;

DataSource:选择创建好的数据源;

SQL:编写sql语句;

add new SQL Dialect:可以添加各个类型数据库的方言;

图片

Generate Input Mappings:

图片

(3)

Grouped by element:返回数据的root节点名;

Row name:每条数据的节点名称;

Add New Output Mapping:返回数据的内容;

图片

返回JSON数据内容

图片

然后请求的时候需要在header中 Accept: application/json,否则返回的数据依然是XML;

图片

备注:JSON的定义必须有一个根节点,否则保存失败;

添加操作

图片

添加资源

图片

备注:

(1)rest参数的名称必须和配置参数名称一致;

(2)resource中没有配置参数,可以用?的形式加入;

使用方式

rest请求:

根据添加资源中的path进行访问,访问地址的前缀名在如图所示的位置:

图片

POST提交,返回json

https://stackoverflow.com/questions/38516900/wso2-dss-value-type-miss-match-expected-value-type-datetime-but-found-s/38625629

Solved this by modifying wso2 dss axis2.xml

<messageFormatter contentType="application/json"
              class="org.apache.axis2.json.JSONMessageFormatter"/>
<messageBuilder contentType="application/json"
                class="org.apache.axis2.json.JSONOMBuilder"/>

加上之后,post和get在DSS中都可以请求,但是不能被api调用,调用则返回的XML,暂时未找到解决办法,需要进一步扩展;
如果,不加上述代码,则显示效果如下图:

API Manage

备注

https://stackoverflow.com/questions/58362974/wso2-mediator-that-removes-specific-jsonobject-occurrences-within-a-json-array

https://docs.wso2.com/display/EI650/Working+with+JSON+Message+Payloads#WorkingwithJSONMessagePayloads-Script

完整分类demo:

http://bsenduran.blogspot.com/2017/08/while-loop-in-wso2-esb.html

smooks Mediator XML to CSV

http://wso2-oxygen-tank.10903.n7.nabble.com/Smooks-Mediator-XML-to-CSV-with-same-repeated-element-in-two-tags-td157640.html#a157641

ESB并发

并发线程vfs-worker

大力气分享,有没有赞

  • 7
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值