2013-04-23 50 views
2

我有一個帶Wslite插件的SOAP客戶端,工作正常,但參數不是以最好的方式發送。GRAILS SOAP客戶端WSLITE參數

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服務拋出沒有發送的參數例外。

我在做什麼錯? :(

感謝

回答

0

我認爲你需要鍵入

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

,使這項工作。