5
someone with some experience with Rails integration with the Webmotors Api?
I am using Gem SAVON to integrate the application with the site API and am getting the error:
Savon::Soapfault: (Soap:Server) Server was Unable to process request. ---> Object Reference not set to an instance of an Object.
What I’m doing is:
def self.login_webmotors
cnpj = "xxxxxxxxxx"
email = "xxxxxxxx"
senha = "xxxxxxxx"
#wdsl_add = 'http://www.webmotors.com.br/IntegracaoRevendedor/wsEstoqueRevendedorWebMotors.asmx?WSDL'
login_url = 'http://www.webmotors.com.br/IntegracaoRevendedor/wsLoginSistemaRevendedor.asmx?WSDL'
login = Savon.client(wsdl: login_url,
log: true,
log_level: :debug,
pretty_print_xml: true)
response = login.call(:autenticar, message: { cnpj: cnpj, email: email, senha: senha })
Rails.application.config.hash_webmotors = response.body[:autenticar_response][:autenticar_result][:hash_autenticacao]
Savon.client(headers: { "hash_autenticacao" => Rails.application.config.hash_webmotors })
end
and then:
def self.adicionar_carro
login_webmotors
wDSL = 'http://www.webmotors.com.br/IntegracaoRevendedor/wsEstoqueRevendedorWebMotors.asmx?WSDL'
add = Savon.client(wsdl: wDSL,
log: true,
log_level: :debug,
pretty_print_xml: true)
message = { codigo_anuncio: 1234,
codigo_modalidade: 1,
tipo_anuncio: "teste",
codigo_marca: 1,
codigo_modelo: 1,
codigo_versao: 1,
ano_modelo: 2000,
ano_fabricacao: 1995,
km: 20000,
placa: "pg1234",
codigo_cambio: 1 }
carro = add.call(:incluir_carro, message: message )
end
but always bump into the same mistake
Savon::Soapfault: (Soap:Server) Server was Unable to process request. ---> Object Reference not set to an instance of an Object.
To complete the problem, I contacted the Webmotors and they answered that not releasing the Api for new systems, it is only working for systems already approved. That is, any attempt to integrate the system currently is useless.
– Fernando Aureliano