web-services - GRAILS SOAP CLIENT WSS​​ITE参数

标签 web-services grails grails-plugin

我有一个带有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服务将引发异常,但不发送任何参数。

我究竟做错了什么? :(

谢谢

最佳答案

我认为您需要输入

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

使这项工作。

关于web-services - GRAILS SOAP CLIENT WSS​​ITE参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16168344/

相关文章:

java - 有什么方法可以对采用 MediaType.MULTIPART_FORM_DATA 进行文件上传的休息服务进行 junit 测试吗?

Java 从 inputStream 创建图像

grails - Grails Spring Security InterceptUrlMap:如何限制对index.gsp的访问

javascript - Grails 从 1.4.0 降级到 1.3.7 并破坏了 jQuery 插件

asp.net - 更改 ASP.NET 为 ASP.NET Web 服务生成的 WSDL

web-services - 为什么 xsd 模式无法验证带有限制 maxLength 的字符串长度

java - 从 eclipse 使用 tomcat 服务器运行 web 项目

grails - 如何在Grails中以编程方式获取运行时参数

validation - 我无法根据 grails 'inList' 中的 double 列表验证 double

apache - 为插件 [资源 :1. 1.6] 配置动态方法时出错:无法获取属性 'pluginPath'