WSO2 ESB调用未通过信封

WSO2 ESB调用未通过信封,wso2,esb,Wso2,Esb,我有一个API的形式 <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"/> <paylo

我有一个API的形式

<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>

在这一点上,我只是试图掌握连接器和API的概念,以便将其应用到我的工作中,但我遇到了一个障碍。任何与外部SOAP服务通信的尝试(我的ESB将需要这样做)要么找不到端点,要么传递SOAP信封中的值失败

如上所述,代码将找到端点,但请求中的输入值inputString始终为null。它本质上与将该地址放入浏览器完全相同,而浏览器完全忽略了SOAP信封,但是记录调用会按预期将信封打印到控制台,因此信封会生成,但不会发送到应用程序服务器

我也尝试过:

1) 将端点地址更改为服务端点,而不是特定操作。这会导致来自的错误,因为声明找不到该操作。此端点和操作在SoapUI中按预期工作

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

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


在这一点上,我已经用尽了我对ESB公认的拙劣理解。

为了调用我的服务,我这样设置了我的中介

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

true中的阻塞属性用于执行同步消息传递

<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>

$1

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

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

true中的阻塞属性用于执行同步消息传递

<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>

$1