Rails and Webmotors
Anyone with any experience with Rails integration with the Webmotors APi?
I am using the gem SAVON to integrate the application with the site API and I am getting the error:
Soap:: 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 I always bump into the same error
Soap:: SOAPFault: (soap: Server) Server was unable to process request. --- >Object reference not set to an instance of an object.
5
Author: Fernando Aureliano, 2015-12-24
1 answers
Man I had this same problem it's simple...
Tests like this
Car = add.call (: include_car, pAnuncio : message)
Att
-3
Author: Tiago Guerra, 2019-11-24 15:34:04