Appearance
SoapReturn
WebService流程的数据输出控件,服务运行时该控件执行完毕后结束所属的流程。
业务属性
属性 | 含义 | 说明 | 输入限定 | 示例值 |
---|---|---|---|---|
enable | 是否启用该控件,未启用时不编译 | 是否编译 | 选择值 | 启用 |
text | 与控件关联的文本 | 设计页控件显示 | 常量 | return |
dataFormat | 返回数据 | webService请求的返回数据 | 常量,Xml数据节点可用流程变量 /流程变量 |
dataFormat输入说明
dataFormat中的Xml格式数据请严格按照WebService流程的返回参数格式的定义来设置。
例:
Webservice流程中的返回参数格式定义为:
返回一个名称为responseData的自定义类型参数,该类型中含有一个名称为key、类型为string的属性
则dataFormat的返回Xml框架为:
xml<responseData> <key>?</key> </responseData>
<responseData> <key>?</key> </responseData>
只需要将
?
更换成实际数据即可
使用示例
假设Webservice流程中的返回参数格式定义为:
返回一个名称为responseData的自定义类型参数,该类型中含有一个名称为key、类型为string的属性

输出常量
- SoapReturn控件属性设置
dataFormat输入:
xml
<responseData>
<key>hello orapis</key>
</responseData>
<responseData>
<key>hello orapis</key>
</responseData>

- WebService调用
使用http请求访问该Web方法:
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
根据
http://localhost:6636/api?wsdl
(api
为项目属性url前缀、localhost
为服务器IP)获取WSDL文件,解析该WSDL文件可获取该http请求url
和请求体
http返回参数:
xml
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>
输出指定变量
- 定义变量
使用Var控件,定义string变量outputData
,内容为:
xml
<responseData>
<key>hello orapis</key>
</responseData>
<responseData>
<key>hello orapis</key>
</responseData>

- SoapReturn控件属性设置
dataFormat输入:
xml
#{outputData}
#{outputData}

- WebService调用
使用http请求访问该Web方法:
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
http返回参数:
xml
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>
Xml数据中使用流程变量
使用Var控件,定义string变量outputStr
,内容为:hello orapis

- SoapReturn控件属性设置
dataFormat输入:
xml
<responseData>
<key>#{outputStr}</key>
</responseData>
<responseData>
<key>#{outputStr}</key>
</responseData>

- WebService调用
使用http请求访问该Web方法:
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
$ curl -X POST "http://localhost:6636/newComponent/ws_demo" -H "Content-Type: text/xml;charset=UTF-8" -d "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:orap=\"http://www.orapis.com/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <orap:WebServiceFlow_Request> <orap:requestData> <orap:keyDemo>a</orap:keyDemo> </orap:requestData> </orap:WebServiceFlow_Request> </soapenv:Body> </soapenv:Envelope>"
http返回参数:
xml
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<WebServiceFlow_Response>
<responseData>
<key>hello orapis</key>
</responseData>
</WebServiceFlow_Response>
</soap:Body>
</soap:Envelope>