0

I'm calling a webservice from Db2 9.1 on zOS using function SOAPHTTPNV. The result comes back ok, but the webservice is called multiple times, once for every row in the resultset (or occurrence of element ROW in the response). Why is that ?

The SQL

SELECT T.NR_KAT, T.PNR_F
FROM
XMLTABLE(
xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/' AS
"soap",
'http://schemas/SERVICE/100921' AS "p"),
'$d/soap:Envelope/soap:Body/p:SERVICE_RESPONSE/p:document/p:result/p:ROW'
PASSING XMLPARSE(
DOCUMENT DB2XML.SOAPHTTPNV(
'http://serviceurl',
VARCHAR(''),
VARCHAR('<soap:Envelope
    request_simplified
</soap:Envelope>'
))) AS "d"
COLUMNS
NR_KAT VARCHAR(2) PATH 'p:NR_KAT',
PNR_F  VARCHAR(12) PATH 'p:PNR_F'
) AS T
;

The result of the SQL in SPUFI

NR_KAT  PNR_F
---------+---------+---------+---------+------
09      194513051834
08      194515042978
19      194515300398

The xml response from webservice

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
        <Body>
    <SERVICE_RESPONSE xmlns="http://schemas/SERVICE/100921">
         <document>
             <result>
                 <ROW>
                    <NR_KAT>09</NR_KAT>
                    <PNR_F>194513051834</PNR_F>
                </ROW>
                 <ROW>
                    <NR_KAT>08</NR_KAT>
                    <PNR_F>194515042978</PNR_F>
                </ROW>
                 <ROW>
                    <NR_KAT>19</NR_KAT>
                        <PNR_F>194515300398</PNR_F>
                    </ROW>    
                    </result>
        </document>
    </SERVICE_RESPONSE>
    </Body>
    </Envelope>
4

2 回答 2

0

尝试使用 XMLTABLE 函数的 BY REF 子句:

SELECT T.NR_KAT, T.PNR_F
FROM XMLTABLE(xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/' AS "soap",
                             'http://schemas/SERVICE/100921'             AS "p"),
              '$d/soap:Envelope/soap:Body/p:SERVICE_RESPONSE/p:document/p:result/p:ROW'
              PASSING BY REF XMLPARSE(...))) AS D
              COLUMNS NR_KAT VARCHAR(2)  PATH 'p:NR_KAT',
                      PNR_F  VARCHAR(12) PATH 'p:PNR_F') AS T
;
于 2013-01-08T14:47:30.590 回答
0

该症状与 APAR PM52237 中描述的症状相匹配。APAR PM52237 修复了为 XMLTABLE 返回的每一行调用 XMLTABLE 函数的参数的问题。请确保您的 z/OS 系统上已安装 PTF UK77921(用于 DB2 9)。

于 2013-01-12T00:22:08.357 回答