GroovyWS WSClient抢占式基本身份验证

时间:2013-01-16 10:32:07

标签: grails groovy basic-authentication groovyws

我无法在groovyws中设置抢占式身份验证。 (ws提供者需要抢占式身份验证。)

我试图找到groovyws document,但没有任何线索。

import groovyx.net.ws.WSClient

//def proxy = new WSClient("http://202.44.4.97/webservice/pttinfo.asmx?wsdl", this.class.classLoader)
def proxy = new WSClient("http://192.168.3.69/provider/myService", this.class.classLoader)
proxy.setBasicAuthentication('user', 'pass')

proxy.initialize()

以下是错误。

Caused by: java.io.IOException: Server returned HTTP response code: 405 for URL: http://192.168.3.69/provider/myService

1 个答案:

答案 0 :(得分:2)

你试过groovy-wslite吗?对于GroovyWS,它说in the documentation

  

由于项目目前处于休眠状态的可用性较低,您可能会将groovy-wslite视为替换模块

所以afaics,这应该接近(我假设你是using SOAP):

import wslite.soap.*
def client = new SOAPClient('http://192.168.3.69/provider/myService')
client.authorization = new HTTPBasicAuthorization( 'user', 'pass' )

instructions for getting wslite working with Grails here