在WSO2 ESB中为新创建的API获取“发送请求之前关闭连接”

时间:2019-01-29 21:15:07

标签: wso2esb

向端点发出请求时,我的WSO2 ESB API中出现“发送请求之前关闭连接”的信息。我没有使用代理服务器。

以下是我创建的API的来源:

<api xmlns="http://ws.apache.org/ns/synapse" name="WorkspaceONEUser" context="/workspaceone/user" port="8243">
   <resource methods="POST" uri-template="*">
      <inSequence>
         <log>
            <property name="Message Flow" value="POST WorkspaceONEUser Search - IN"/>
         </log>
         <send>
            <endpoint key="workspaceOneUserSearchEndpoint"/>
         </send>
      </inSequence>
      <outSequence>
         <property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
         <property name="Access-Control-Allow-Origin" value="HOST_NAME" scope="transport" type="STRING"/>
         <property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
         <log>
            <property name="Message Flow" value="POST WorkspaceONEUser - OUT"/>
         </log>
         <log level="full"/>
         <send/>
      </outSequence>
      <faultSequence>
         <log>
            <property name="message" value="in fault"/>
            <property name="text" value="An unexpected error occured"/>
            <property name="message" expression="get-property('ERROR_MESSAGE')"/>
            <property name="header" expression="get-property('REQUEST_HOST_HEADER')"/>
         </log>
      </faultSequence>
   </resource>
   <resource methods="OPTIONS" url-mapping="/">
      <inSequence>
         <log>
            <property name="Message Flow" value="IN OPTIONS"/>
         </log>
         <log level="full"/>
         <property name="Access-Control-Allow-Headers" value="authorization,Access-Control-Allow-Origin,Content-Type,X-Requested-With,Accept,Allow,Access-Control-Allow-Credentials" scope="transport"/>
         <property name="Access-Control-Allow-Origin" value="https://HOST_NAME" scope="transport" type="STRING"/>
         <property name="Access-Control-Allow-Credentials" value="true" scope="transport" type="STRING"/>
         <respond/>
      </inSequence>
   </resource>
</api>

在日志中,连接似乎在发送出去之前已关闭:

TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} -  Sending message through endpoint : workspaceOneUserSearchEndpoint resolving to address = https://TARGET_HOST {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} -  SOAPAction: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.endpoints.AddressEndpoint} -  WSA-Action: null {org.apache.synapse.endpoints.AddressEndpoint}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} -  Sending [add = false] [sec = false] [mtom = false] [swa = false] [format = null] [force soap11=false] [force soap12=false] [pox=false] [get=false] [encoding=null] [to=https://TARGET_HOST] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} -  Message [Original Request Message ID : urn:uuid:09116122-22b4-4acf-be8e-31570623bd39] [New Cloned Request Message ID : urn:uuid:b242c096-4348-4977-8048-d70a5ac8c15b] {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,283] DEBUG {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient} -  Setting Timeout for endpoint : Endpoint [workspaceOneUserSearchEndpoint], URI : https://TARGET_HOST to static timeout value : 120000 {org.apache.synapse.core.axis2.Axis2FlexibleMEPClient}
TID: [-1234] [] [2019-01-28 13:38:29,284] DEBUG {org.apache.synapse.core.axis2.SynapseCallbackReceiver} -  Callback added. Total callbacks waiting for : 2 {org.apache.synapse.core.axis2.SynapseCallbackReceiver}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} -  start writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.axis2.transport.http.ApplicationXMLFormatter} -  end writeTo() {org.apache.axis2.transport.http.ApplicationXMLFormatter}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.builtin.SendMediator} -  End : Send mediator {org.apache.synapse.mediators.builtin.SendMediator}
TID: [-1234] [] [2019-01-28 13:38:29,297] DEBUG {org.apache.synapse.mediators.base.SequenceMediator} -  End : Sequence <anonymous> {org.apache.synapse.mediators.base.SequenceMediator}
TID: [-1] [] [2019-01-28 13:38:34,781]  WARN {org.apache.synapse.transport.passthru.TargetHandler} -  Connection closed before sending request out  Remote Address : wsoidm01pa.jefferson.edu/147.140.23.161:443 {org.apache.synapse.transport.passthru.TargetHandler}

有人知道这是什么原因吗?我怀疑这表明ESB和下游服务器之间的连接在ESB能够完全写出请求之前已经关闭。

但是,我可以从几乎完全相同的另一个API张贴到同一端点。我的API或端点是否存在明显导致问题的神秘问题?

1 个答案:

答案 0 :(得分:0)

尝试在您的<send>中介者之前添加此属性。

<property name="ClientApiNonBlocking"
       value="true"
       scope="axis2"
       action="remove"/>

它将删除您的<send>调解器中的“客户端Api非阻止”(默认情况下启用)