WSO2 ESB调用不及格信封

问题描述:

我有以下形式的APIWSO2 ESB调用不及格信封

<api xmlns="http://ws.apache.org/ns/synapse" name="MyRestApi" context="/practice"> 
<resource methods="GET" uri-template="/{someValue}"> 
    <inSequence> 
    <header name="Action" value="urn:sayHello"/> 
    <payloadFactory media-type="xml"> 
     <format> 
      <p:sayHello xmlns:p="http://practice"> 
       <p:inputString>$1</p:inputString> 
      </p:sayHello> 
     </format> 
     <args> 
      <arg evaluator="xml" expression="$ctx:uri.var.someValue"/> 
     </args> 
    </payloadFactory> 
    <log level="full"/> 
    <call> 
     <endpoint> 
      <address uri="http://192.168.0.105:9763/services/Practice/sayHello" format="soap12"/> 
     </endpoint> 
    </call> 
    <enrich> 
     <source type="body" clone="true"/> 
     <target type="property" action="child" property="body_of_first_call"/> 
    </enrich> 
    <property xmlns:ns="http://practice" name="response" expression="//ns:return" scope="default" type="STRING"/> 
    <property xmlns:ns="http://practice" name="response2" expression="//ns:sayHelloResponse" scope="default" type="STRING"/> 
    <log> 
     <property name="myValue" expression="$ctx:response"/> 
     <property name="myValue2" expression="$ctx:response2"/> 
     <property name="myValue3" expression="$ctx:body_of_first_call"/> 
    </log> 
    <payloadFactory media-type="xml"> 
     <format> 
      <result> 
       <sentValue>$1</sentValue> 
       <returnedValue>$2</returnedValue> 
      </result> 
     </format> 
     <args> 
      <arg evaluator="xml" expression="$ctx:uri.var.someValue"/> 
      <arg evaluator="xml" expression="$ctx:response"/> 
     </args> 
    </payloadFactory> 
    <property name="messageType" value="application/xml" scope="axis2" type="STRING"/> 
    <respond/> 
    </inSequence> 
    <outSequence/> 
    <faultSequence/> 
</resource> 
</api> 

几乎完全基于引导发现here

这是在这一点上只是试图抓住连接器和API的概念所以我可以将它应用于我在工作中所做的事情,但我遇到了一些障碍。任何尝试与外部SOAP服务进行通信(ESB需要执行的操作),都无法找到端点或无法传递SOAP信封中的值。

如上所述,代码将查找端点,但请求中的输入值inputString始终为空。它与将该地址放入浏览器中完全相同,完全省略了SOAP信封,然而,记录该调用会按预期方式将信封打印到控制台,因此信封正在生成但未进入应用程序服务器。

事情我也都试过:

1)改变端点地址是服务端点,而不是特定的操作。这会导致AS发生错误,声称无法找到操作。此端点和操作在SoapUI中按预期工作。

2)使用WSDL端点而不是地址。结果与1相同。

3)添加/删除标题标签。所有三个端点都已尝试使用/不使用标题标记。他们的结果不会改变。

在这一点上,我已经穷尽了我对ESB的理解。

为了调用我的服务,我以这种方式设置了我的中介。

<call blocking="true"> 
    <endpoint> 
    <address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/> 
    </endpoint> 
</call> 

在真正的粘连性做同步消息

<call blocking="true"> 

</call> 

这是我的API

<api xmlns="http://ws.apache.org/ns/synapse" name="showByIdCallMediator" context="/getByIdCall"> 
    <resource methods="GET" uri-template="/{Id}"> 
     <inSequence> 
     <property name="getId" expression="get-property('uri.var.Id')" scope="default" type="STRING"/> 
     <log> 
      <property name="ID" expression="get-property('getId')"/> 
     </log> 
     <payloadFactory media-type="xml"> 
      <format> 
       <p:searchPharmacy xmlns:p="http://pharmacy.arce.org"> 
        <ax22:pharmacy xmlns:ax22="http://pharmacy.arce.org"> 
        <xs:id xmlns:xs="http://pharmacy.arce.org/xsd">$1</xs:id> 
        </ax22:pharmacy> 
       </p:searchPharmacy> 
      </format> 
      <args> 
       <arg evaluator="xml" expression="get-property('getId')"/> 
      </args> 
     </payloadFactory>   
     <header name="Action" scope="default" value="urn:searchPharmacy"/>   
     <call blocking="true"> 
      <endpoint> 
       <address uri="http://169.254.193.10:9769/services/ServicePharmacy" format="soap11"/> 
      </endpoint> 
     </call> 
     <log> 
      <property xmlns:ns="http://org.apache.synapse/xsd" name="Status" expression="get-property('axis2','HTTP_SC')"/> 
     </log> 
     <log level="full"/> 
     <enrich> 
      <source type="body" clone="true"/> 
      <target type="property" property="Ouput_Respose_Service"/> 
     </enrich> 
     <log level="custom" separator=","> 
      <property name="Service_Response" expression="get-property('Ouput_Respose_Service')"/> 
     </log> 
     <respond description=""/> 
     </inSequence> 
     <outSequence> 
     <log level="full"/> 
     <send/> 
     </outSequence> 
     <faultSequence> 
     <sequence key="{faultSEQ}"/> 
     </faultSequence> 
    </resource> 
</api>