2

正常に動作する Wslite プラグインを備えた SOAP クライアントがありますが、パラメーターが最適な方法で送信されません。

def calcClient(Integer n1, Integer n2) throws Exception {
    def response
    try {
        soapClient.serviceURL = "http://localhost:8080/SISAP/services/sendMail?wsdl"

        response = soapClient.send() {
            soapNamespacePrefix "soap"
            envelopeAttributes "xmlns:util":"http://util.unime.edu.br/"
            body {
                calc{
                    //is not the best way           
                    mkp.yieldUnescaped "<util:number1>$n1</util:number1>"
                    mkp.yieldUnescaped "<util:number2>$n2</util:number2>"
                }
            }
        }
    } catch (Exception exception) {
        log.error(exception.message)
        throw exception
    }

    println response.body.calculaResponse.return
    return
}

正常に動作していますが、試してみると:

calc{
   number1(n1)
   number2(n2)
}

または

calc{
   "util:number1($n1)"
   "util:number2($n2)"
}

または

calc{
   "{util}number1($n1)"
   "{util}number2($n2)"
}

パラメーターが送信されない場合、Web サービスは例外をスローします。

私は何を間違っていますか?:(

ありがとう

4

1 に答える 1

0

入力する必要があると思います

 mkp.yieldUnescaped.number1('xmlns':'util',n1)
 mkp.yieldUnescaped.number2('xmlns':'util',n2)

これを機能させるために。

于 2013-11-13T12:03:05.773 に答える