Skip to content

SoapReturn

WebService流程的数据输出控件,服务运行时该控件执行完毕后结束所属的流程。

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
text与控件关联的文本设计页控件显示常量return
dataFormat返回数据webService请求的返回数据常量,Xml数据节点可用流程变量/流程变量

dataFormat输入说明

dataFormat中的Xml格式数据请严格按照WebService流程返回参数格式的定义来设置。

例:

Webservice流程中的返回参数格式定义为:

返回一个名称为responseData的自定义类型参数,该类型中含有一个名称为key、类型为string的属性

img_soap_return_1.png

dataFormat的返回Xml框架为:

xml
<responseData>
    <key>?</key>
</responseData>
<responseData>
    <key>?</key>
</responseData>

只需要将?更换成实际数据即可

使用示例

假设Webservice流程中的返回参数格式定义为:

返回一个名称为responseData的自定义类型参数,该类型中含有一个名称为key、类型为string的属性

img_soap_return_1.png

输出常量

  • SoapReturn控件属性设置

dataFormat输入:

xml
<responseData>
 <key>hello orapis</key>
</responseData>
<responseData>
 <key>hello orapis</key>
</responseData>
img_soap_return_2.png
  • 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?wsdlapi为项目属性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>
img_soap_return_3.png
  • SoapReturn控件属性设置

dataFormat输入:

xml
#{outputData}
#{outputData}
img_soap_return_4.png
  • 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

img_soap_return_5.png
  • SoapReturn控件属性设置

dataFormat输入:

xml
<responseData>
 <key>#{outputStr}</key>
</responseData>
<responseData>
 <key>#{outputStr}</key>
</responseData>
img_soap_return_6.png
  • 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>