XPath与模拟服务器中的XML发布请求不匹配

时间:2018-08-07 22:28:16

标签: java rest xpath mockserver

我正在使用mock-server模拟API的依赖关系。它必须服务和接受肥皂。

我需要三个类似的请求。这是一个xml示例:

            <?xml version="1.0" encoding="UTF-8"?>
            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:car="http://schemas.datacontract.org/2004/07/X.Core.Servico.ComunicacaoBase" xmlns:car1="http://schemas.datacontract.org/2004/07/X.Core.Servico.Validacao" xmlns:car2="http://schemas.datacontract.org/2004/07/X.Servico.Dominio.Entidade" xmlns:tem="http://tempuri.org/">
            <soapenv:Header>
                <TokenPlataformaRelacionamento>Chave</TokenPlataformaRelacionamento>
            </soapenv:Header>
            <soapenv:Body>
                <tem:Obter>
                    <tem:solicitacao>
                        <car:CanalSolicitacao>canal</car:CanalSolicitacao>
                        <car:ChaveSolicitacao>chave</car:ChaveSolicitacao>
                        <car2:DominiosRequeridos>
                        <arr:string>D12</arr:string>
                        </car2:DominiosRequeridos>
                    </tem:solicitacao>
                </tem:Obter>
            </soapenv:Body>
            </soapenv:Envelope>

唯一的区别是car2:DominiosRequeridos / arr:string中的值。但是寄出所有期望之后。总是返回一个,并且与请求中的car2:DominiosRequeridos / arr:string中的值无关紧要。

这是模拟的期望:

            {
                "httpRequest" : {
                "method" : "POST",
                "path" : "/X.Servico.Dominio/Dominio.svc",
                "headers": {
                    "Content-Type": [ "application/soap+xml; charset=utf-8" ],
                    "action": [ "http://tempuri.org/ITest/Test" ]
                },
                "body": {
                    "type": "XPATH",
                    "xpath": "//tem:solicitacao[car2:DominiosRequeridos/arr:string='D12']"
                }
                },
                "httpResponse" : {
                "statusCode": 200,
                "headers": {
                    "Content-Type": [ "application/soap+xml; charset=utf-8" ]
                },
                "body" : "XML_RESPONSE"
                },
                "times": {
                "unlimited": true
                }
            }

0 个答案:

没有答案