Topic: Consume webservice

I'm trying consume this webservice, but i have no idea how i can do that..

I already search for some topics using soap4r, savon (i cant install, always return error when i try install gem)

I'm using rails 3.0.9.

For test this webservice, can use this input parameter: 83321230

It is a postal code from brazilian streets

Last edited by markd2lp (2011-09-06 09:49:36)

Re: Consume webservice

def busca_cep
    require 'soap/rpc/driver'

    XSD::Charset.encoding = 'UTF8'
    wsdl = ''
    namespace = ''
    webmethod = "cep"
    soapoperation = namespace + webmethod
    param1 = "strcep"

    #Initializing the SOAP RPC driver using the WSDL
    driver =, namespace)
    #Setting the encoding style to ASPDotNetHandler encoding style. Failing to do so will return null username and password in the web service.
    driver.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
    #Initialize the handler for web method in the client
    driver.add_method_with_soapaction(webmethod, soapoperation, param1)
    #Setting the driver to dump debug information to the console
    driver.wiredump_dev = STDERR
    #Invoke the web method and retrieve the return value
    result = driver.cep("#{params[:id]}")   
      render :json => { :success => false }
      render :json => { :success => true }

This code are not working,

undefined method `name=' for #<XSD::QName:0x..fdb764958 {}item>

Last edited by markd2lp (2011-09-06 10:32:16)