调解员发送奇怪的信封

Callout mediator sending strange envelope

使用 smooks 调解器读取逗号分隔的文件。对于每一行调用另一个服务。此请求受到监视(见下文)。这不是我所期望的,它失败了。

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="agreementsCSVFileProxy"
       transports="vfs"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <log level="full"/>
         <smooks config-key="smooks">
            <input type="text"/>
            <output type="xml"/>
         </smooks>
         <iterate xmlns:ns2="http://org.apache.synapse/xsd"
                  xmlns:sec="http://secservice.samples.esb.wso2.org"
                  expression="//csv-set/csv-record">
            <target>
               <sequence>
                  <property name="customer_id" expression="//csv-record/customer_id/text()"/>
                  <property name="date_time" expression="//csv-record/date_time/text()"/>
                  <property name="agreement_id" expression="//csv-record/agreement_id/text()"/>
                  <property name="product_id" expression="//csv-record/product_id/text()"/>
                  <property name="product_name" expression="//csv-record/product_name/text()"/>
                  <payloadFactory media-type="xml">
                     <format>
                        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                          xmlns:sch="http://domain.com/mifid/timeline/schema/">
                           <soapenv:Header/>
                           <soapenv:Body>
                              <sch:productLookupRequest>
                                 <sch:productId></sch:productId>
                              </sch:productLookupRequest>
                           </soapenv:Body>
                        </soapenv:Envelope>
                     </format>
                     <args>
                        <arg xmlns:ns="http://org.apache.synapse/xsd"
                             evaluator="xml"
                             expression="get-property('product_id')"/>
                     </args>
                  </payloadFactory>
                  <property name="Content-Type"
                            value="application/xml"
                            scope="axis2"
                            type="STRING"/>
                  <callout serviceURL="http://localhost:9088/mockproductLookupSoapBinding"
                           action="urn:lookupProduct">
                     <source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                             xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                             xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
                     <target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
                             xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
                             xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
                  </callout>
                  <property xmlns:ns="http://org.apache.synapse/xsd"
                            xmlns:sch="http://domain.com/mifid/timeline/schema/"
                            name="product_name"
                            expression="//sch:productName"/>
                  <payloadFactory media-type="xml">
                     <format>
                        <dat:insertAgreement xmlns:dat="http://ws.wso2.org/dataservice">
                           <dat:p_customer_id></dat:p_customer_id>
                           <dat:p_record_type_id>1</dat:p_record_type_id>
                           <dat:p_date_time></dat:p_date_time>
                           <dat:p_agreement_id></dat:p_agreement_id>
                           <dat:p_product_id></dat:p_product_id>
                           <dat:p_product_name></dat:p_product_name>
                        </dat:insertAgreement>
                     </format>
                     <args>
                        <arg evaluator="xml" expression="get-property('customer_id')"/>
                        <arg evaluator="xml" expression="get-property('date_time')"/>
                        <arg evaluator="xml" expression="get-property('agreement_id')"/>
                        <arg evaluator="xml" expression="get-property('product_id')"/>
                        <arg evaluator="xml" expression="get-property('product_name')"/>
                     </args>
                  </payloadFactory>
                  <header name="Action"
                          scope="default"
                          value="http://ws.wso2.org/dataservice"/>
                  <send>
                     <endpoint>
                        <address uri="http://localhost:9767/services/Timeline/" format="soap11"/>
                     </endpoint>
                  </send>
               </sequence>
            </target>
         </iterate>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">15</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file://C:\temp\test\original</parameter>
   <parameter name="transport.vfs.FileURI">file://C:\temp\test\in</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file://C:\temp\test\fail</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
   <parameter name="transport.vfs.ContentType">text/plain</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>

下面是对tcpmon监控的外部服务的请求。就像标注之前的 payloadfactory 不存在一样。

POST /mockproductLookupSoapBinding HTTP/1.1
Content-Type: text/plain; charset=UTF-8;action="urn:lookupProduct";
FILE_NAME: agreement_small.txt
FILE_PATH: /temp/test/in/agreement_small.txt
FILE_URI: file:///C:/temp/test/in/agreement_small.txt
User-Agent: Axis2
Host: 127.0.0.1:9088
Transfer-Encoding: chunked

0

达到预期效果。

HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Server: Jetty(6.1.26)

151
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">  
   <soapenv:Body>    
      <soapenv:Fault>      
         <faultcode>Server</faultcode>      
         <faultstring>Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]</faultstring>    
      </soapenv:Fault>  
   </soapenv:Body></soapenv:Envelope>
0

我错过了什么?

当 inSequence 启动时,内容类型为 text/plain 并且您不会在 callout mediator 之前更改它(请参阅 tcpmon:Content-Type:text/plain;字符集=UTF-8;动作="urn:lookupProduct";)

您的 soap 正文中没有文本节点,因此没有可发送的内容

在标注调解器之前设置此 属性:

<property name="messageType" value="text/xml" scope="axis2"/>