Xml 从soap中的数据库查询填充多个响应项
我试图使soap模拟服务更具动态性,但遇到了一些问题。我不知道如何用数据库行中的信息填充多个响应项。我将尽可能地解释项目设置和我正在努力做的事情 项目工作原理如下: 1.应用程序被设置为向soap mockservice发送xml请求。 2.mockservice使用groovy脚本设置数据库连接。它使用请求中传递的信息从数据库中获取相关行 (以下是试图找出答案的部分) 3.数据库查询响应中的每一行都是响应中的一个单独项 一个我想要的例子 请求:Xml 从soap中的数据库查询填充多个响应项,xml,groovy,request,response,soapui,Xml,Groovy,Request,Response,Soapui,我试图使soap模拟服务更具动态性,但遇到了一些问题。我不知道如何用数据库行中的信息填充多个响应项。我将尽可能地解释项目设置和我正在努力做的事情 项目工作原理如下: 1.应用程序被设置为向soap mockservice发送xml请求。 2.mockservice使用groovy脚本设置数据库连接。它使用请求中传递的信息从数据库中获取相关行 (以下是试图找出答案的部分) 3.数据库查询响应中的每一行都是响应中的一个单独项 一个我想要的例子 请求: <?xml version="1.0" e
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<qdiGetPartyFull xmlns="urn:QDIServices">
<anItem>3328666</anItem>
<anItem>3328666</anItem>
</qdiGetPartyFull>
</soapenv:Body>
3328666
3328666
答复:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ItemFullResponse xmlns="urn:Services">
<ItemFullReturn>
<ItemReponse>
<country>qwe</country>
<county>abc</county>
<postcode>123</postcode>
<itemError>
<errorCode>0</errorCode>
<errorMessage xsi:nil="true"/>
</itemError>
<status>xyz</status>
</ItemReponse>
<ItemReponse>
<country>qwe</country>
<county>abc</county>
<postcode>123</postcode>
<itemError>
<errorCode>0</errorCode>
<errorMessage xsi:nil="true"/>
</itemError>
<status>xyz</status>
</ItemReponse>
<iError xsi:nil="true"/>
</ItemFullReturn>
</ItemFullResponse>
</soapenv:Body>
qwe
abc
123
0
xyz
qwe
abc
123
0
xyz
对不起,格式不好
我现在的位置:
我让数据库连接使用groovy返回行,我只需要弄清楚如何将每一行放入一个新的itemResponse
我还应该提到,请求中的项目数=响应中的项目数/行数解决了这个问题
我使用MarkupBuilder生成xml,然后使用上下文将生成的xml写入响应
可能是更好的方法,但这似乎有效
我完成后会发布代码吗