WSO2 ESB 没有向 WSO2 DSS 发送 clinicId 参数

WSO2 ESB does not sent a clinicId param to WSO2 DSS

在WSO2配置的代理服务中,不向DSS发送clinicId参数。在 DSS 的日志中给出异常:

Default Namespace: <a href="https://bur.test.ru/dss/services/tfoms" rel="nofollow">https://bur.test.ru/dss/services/tfoms</a>
Current Request Name: get_single_inserted_branch_by_id
Current Params: {clinicID=}
Nested Exception:-
java.lang.NumberFormatException: For input string: ""</pre>

在来自 ESB 的日志中:


Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processPreNormalQuery': For input string: ""
DS Code: DATABASE_ERROR
Source Data Service:-
Name: TEST
Location: \TEST.dbs
Description: Service generates hospitalisation&<br>
Default Namespace: <a href="https://bur.TEST.ru/dss/services/tfoms" rel="nofollow">https://bur.TEST.ru/dss/services/tfoms</a>
Current Request Name: get_single_inserted_branch_by_id
Current Params: {clinicID=}
Nested Exception:-
java.lang.NumberFormatException: For input string: ""
</pre>
在 WSO2 DSS 上它运行良好,它从 postgres 获取信息。
这是来自 WSO2 ESB 的代理服务代码:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="BurProxy"
       transports="http,https"
       statistics="disable"
       trace="enable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="CLINIC_ID"
                   expression="//clinicID/text()"
                   scope="axis2"
                   type="STRING"/>
         <log level="full">
            <property name="CLINIC_ID" expression="clinicID"/>
         </log>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:tfom="https://bur.cdmarf.ru/dss/services/tfoms">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <tfom:get_single_inserted_branch_by_id>
                        <tfom:clinicID></tfom:clinicID>
                     </tfom:get_single_inserted_branch_by_id>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="$axis2:CLINIC_ID"/>
            </args>
         </payloadFactory>
         <log>
            <property name="PAYLOAD" expression="$body"/>
         </log>
         <call blocking="true">
            <endpoint key="dss"/>
         </call>
         <xslt key="xslt-remove-namespace"/>
         <property name="messageType" value="text/xml" scope="axis2"/>
         <property name="contentType" value="text/xml" scope="axis2"/>
         <property name="rabbitmq.attributes.app.id"
                   value="RMIS"
                   scope="axis2"
                   type="STRING"/>
         <property name="rabbitmq.attributes.type"
                   value="BRANCH"
                   scope="axis2"
                   type="STRING"/>
         <property name="rabbitmq.attributes.user.id"
                   value="rmis"
                   scope="axis2"
                   type="STRING"/>
         <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
         <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
          mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
         <property name="rabbitmq.attributes.custom.message.id"
                   expression="get-property('RABBIT_MESSAGE_ID')"
                   scope="axis2"/>
         <clone continueParent="true">
            <target sequence="writeToFile"/>
         </clone>
         <send>
            <endpoint key="rabbit"/>
         </send>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:tfom="https://bur.cdmarf.ru/dss/services/tfoms">
                  <soapenv:Header/>
                  <soapenv:Body>
                     <tfom:get_inserted_divisions_of_clinic>
                        <tfom:clinicID></tfom:clinicID>
                     </tfom:get_inserted_divisions_of_clinic>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="$axis2:CLINIC_ID"/>
            </args>
         </payloadFactory>
         <call blocking="true">
            <endpoint key="dss"/>
         </call>
         <iterate xmlns:tfoms="https://bur.cdmarf.ru/dss/services/tfoms"
                  continueParent="true"
                  expression="//tfoms:DIVISION"
                  sequential="true">
            <target>
               <sequence>
                  <property name="rabbitmq.attributes.type"
                            value="DIVISION"
                            scope="axis2"
                            type="STRING"/>
                  <property name="messageType" value="xml" scope="axis2"/>
                  <property name="contentType" value="xml" scope="axis2"/>
                  <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
                  <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
                 mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
                  <property name="rabbitmq.attributes.custom.message.id"
                            expression="get-property('RABBIT_MESSAGE_ID')"
                            scope="axis2"/>
                  <xslt key="xslt-remove-namespace"/>
                  <clone continueParent="true">
                     <target sequence="writeToFile"/>
                  </clone>
                  <send>
                     <endpoint key="rabbit"/>
                  </send>
               </sequence>
            </target>
         </iterate>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:tfom="https://bur.cdmarf.ru/dss/services/tfoms">
                  <soapenv:Body>
                     <tfom:get_inserted_liks_division_to_bed>
                        <tfom:clinicID></tfom:clinicID>
                     </tfom:get_inserted_liks_division_to_bed>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="$axis2:CLINIC_ID"/>
            </args>
         </payloadFactory>
         <call blocking="true">
            <endpoint key="dss"/>
         </call>
         <iterate xmlns:tfoms="https://bur.cdmarf.ru/dss/services/tfoms"
                  continueParent="true"
                  expression="//tfoms:DIVISION_LINK_STRUCTURE_BED"
                  sequential="true">
            <target>
               <sequence>
                  <property name="rabbitmq.attributes.type"
                            value="DIVISION_LINK_STRUCTURE_BED"
                            scope="axis2"
                            type="STRING"/>
                  <property name="messageType" value="xml" scope="axis2"/>
                  <property name="contentType" value="xml" scope="axis2"/>
                  <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
                  <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
                 mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
                  <property name="rabbitmq.attributes.custom.message.id"
                            expression="get-property('RABBIT_MESSAGE_ID')"
                            scope="axis2"/>
                  <xslt key="xslt-remove-namespace"/>
                  <clone continueParent="true">
                     <target sequence="writeToFile"/>
                  </clone>
                  <send>
                     <endpoint key="rabbit"/>
                  </send>
               </sequence>
            </target>
         </iterate>
         <payloadFactory media-type="xml">
            <format>
               <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                                 xmlns:tfom="https://bur.cdmarf.ru/dss/services/tfoms">
                  <soapenv:Body>
                     <tfom:get_inserted_amound_bed>
                        <tfom:clinicID></tfom:clinicID>
                     </tfom:get_inserted_amound_bed>
                  </soapenv:Body>
               </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="$axis2:CLINIC_ID"/>
            </args>
         </payloadFactory>
         <call blocking="true">
            <endpoint key="dss"/>
         </call>
         <iterate xmlns:tfoms="https://bur.cdmarf.ru/dss/services/tfoms"
                  continueParent="true"
                  expression="//tfoms:AMOUNT_BED"
                  sequential="true">
            <target>
               <sequence>
                  <property name="rabbitmq.attributes.type"
                            value="AMOUNT_BED"
                            scope="axis2"
                            type="STRING"/>
                  <property name="messageType" value="xml" scope="axis2"/>
                  <property name="contentType" value="xml" scope="axis2"/>
                  <property name="MESSAGE_ID" expression="get-property('MessageID')"/>
                  <script language="js">var messageID = mc.getProperty('MESSAGE_ID').substring(9,45);
                 mc.setProperty("RABBIT_MESSAGE_ID", messageID);</script>
                  <property name="rabbitmq.attributes.custom.message.id"
                            expression="get-property('RABBIT_MESSAGE_ID')"
                            scope="axis2"/>
                  <xslt key="xslt-remove-namespace"/>
                  <clone continueParent="true">
                     <target sequence="writeToFile"/>
                  </clone>
                  <send>
                     <endpoint key="rabbit"/>
                  </send>
               </sequence>
            </target>
         </iterate>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>
                                

</pre>

对于这样的请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:tfom="bur.cdmarf.ru/dss/services/tfoms">
   <soapenv:Header/>
   <soapenv:Body>
     <tfom:get_inserted_amound_bed> 
        <tfom:clinicID>6048820</tfom:clinicID> 
     </tfom:get_inserted_amound_bed>    
   </soapenv:Body>
</soapenv:Envelope>

你可以使用这个中介来捕获和记录 clinic_id 值:

     <property name="CLINIC_ID" xmlns:tfom="bur.cdmarf.ru/dss/services/tfoms"
               expression="//tfom:get_inserted_amound_bed/tfom:clinicID"
               scope="default"
               type="STRING"/>
     <log level="custom">
        <property name="CLINIC_ID_PROPERTY_VALUE" expression="get-property('CLINIC_ID')"/>
     </log>
     <log>
        <property name="PAYLOAD" expression="$body"/>
     </log>

在有效负载工厂调解器中使用相同的表达式来捕获诊所 ID 值:

        <args>
           <arg evaluator="xml" expression="get-property('CLINIC_ID')"/>
        </args>