下面的 Endpoint_BPS_CreateCaseService/UpdateCaseService 端点都指向在 WSO2 BPS 上运行的单向 BPEL 服务。WSO2 BPS 在被调用时立即返回 HTTP 202 接受消息。
如果我使用的客户端应用程序没有获得有效的 SOAP 信封作为响应,它就会抛出一个错误,因此我将使用 ESB 中的代理服务来包装 BPEL 流程。
如何使用 WSO2 ESB 代理服务将 SOAP 信封转发到下面的 Endpoint_BPS_*,然后将 SOAP 信封响应返回给我的客户端应用程序?
如果端点不可用或超时,我还想执行 faultSequence "ProcessFault"。我以前使用 OUT_ONLY 来解决上面的响应问题,但这意味着我无法检测端点问题。除非有可能以某种方式同时进行?
我尝试过的另一件事是克隆消息,但这有点混乱。
非常感谢任何帮助
<proxy xmlns="http://ws.apache.org/ns/synapse" name="BPSProxyService" transports="https,http" statistics="disable" trace="enable" startOnLoad="true">
   <target faultSequence="ProcessFault">
      <inSequence>
         <log level="full">
            <property name="MESSAGE" value="BEGIN BPSProxyService" />
         </log>
         <switch source="//*[local-name()='Operation']">
            <case regex="create">
               <send>
                  <endpoint key="Endpoint_BPS_CreateCaseService" />
               </send>
            </case>
            <case regex="update">
               <send>
                  <endpoint key="Endpoint_BPS_UpdateCaseService" />
               </send>
            </case>
         </switch>
      </inSequence>
      <outSequence>
         <property name="HTTP_SC" value="200" scope="axis2" />
         <class name="esb.mediators.InjectSOAPEnvelope" />
         <log level="full">
            <property name="MESSAGE" value="END BPSProxyService" />
         </log>
         <send />
         <drop />
      </outSequence>
   </target>
   <publishWSDL key="common/bpsproxyservice/bpsproxyservice.wsdl">
      <resource location="schema.xsd" key="common/schema_v2.xsd" />
   </publishWSDL>
</proxy>
小智 6
当您在代理服务的 outSequence 中从后端(如 BPS)收到“HTTP/1.1 202 接受”响应时,您需要该<property name="SC_ACCEPTED" value="false" scope="axis2"/>语句将“202”响应修改为其他内容。
例子:
    <property name="SC_ACCEPTED" value="false" scope="axis2"/>
    <property name="HTTP_SC" value="200" scope="axis2"/>
    <payloadFactory media-type="xml">
        <format>
            <response>
                <result>OK</result>
            </response>
        </format>
        <args/>
    </payloadFactory>
    <send/>
响应转换为带有响应消息的“HTTP/1.1 200 OK”。