Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

xmlrpc PHP: need a functional "read" example

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
phpread
1 Responder
11063 Visualizações
Avatar
Thierry Godin

Hello all,

I try to get "read" working thru xmlrpc with PHP but the only response I get is this kind of stuff  (PHP print_r):

xmlrpcresp Object ( [val] => xmlrpcval Object ( [me] => Array ( [struct] => Array ( [id] => xmlrpcval Object ( [me] => Array ( [string] => 0 ) [mytype] => 1 [_php_class] => ) ) ) [mytype] => 3 [_php_class] => ) [valtyp] => xmlrpcvals [errno] => 0 [errstr] => [payload] => [hdrs] => Array ( [content-type] => text/xml [content-length] => 196 [server] => Werkzeug/0.8.3 Python/2.7.3 [date] => Sat, 05 Jul 2014 16:25:04 GMT ) [_cookies] => Array ( ) [content_type] => text/xml [raw_data] => HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 196 Server: Werkzeug/0.8.3 Python/2.7.3 Date: Sat, 05 Jul 2014 16:25:04 GMT id 0 )

Response is empty (I mean, does not return fields)

For now I managed to login + search or create methods.

Does somebody have a short example for read method that works ?

Thank You

0
Avatar
Cancelar
DelphineL

Hello, try this $msg = new xmlrpcmsg('execute'); $msg->addParam(new xmlrpcval($dbname, "string")); $msg->addParam(new xmlrpcval($userId, "int")); $msg->addParam(new xmlrpcval($password, "string")); $msg->addParam(new xmlrpcval($relation, "string")); $msg->addParam(new xmlrpcval("read", "string")); $msg->addParam(new xmlrpcval($id, "array")); $msg->addParam(new xmlrpcval($fields, "array")); With fields are array of fields you want

DelphineL

And when you try the response is this? It must have a mistake.The good response is something like an array of struct or an array of array i don t remember exactly. With id is the key and the struct is make of field1=value1 field2=value2 etc

Thierry Godin
Autor

Yes response is the one above. But this is an array of arrays . The "struct" one is already on first line but it does not contain the fields I read ("name")

DelphineL

$partner_id = "10"; $id_list = array(new xmlrpcval($partner_id, "int")); $key = array( new xmlrpcval("name", "string"), ); $msg = new xmlrpcmsg('execute'); $msg->addParam(new xmlrpcval($dbname, "string")); $msg->addParam(new xmlrpcval($uid, "int")); $msg->addParam(new xmlrpcval($password, "string")); $msg->addParam(new xmlrpcval("res.partner", "string")); $msg->addParam(new xmlrpcval("read", "string")); $msg->addParam(new xmlrpcval($id_list, "array")); $msg->addParam(new xmlrpcval($key, "array"));

Avatar
DelphineL
Melhor resposta

For me: 

        $val = $res->value()->scalarval();
            
            $ides = array();
            $client = new xmlrpc_client($serverUri.'object');
            $ides[0]=new xmlrpcval(1, "int"); 
            $fields = array(new xmlrpcval("name", "string"), new xmlrpcval("email", "string"));
            
            $msg = new xmlrpcmsg('execute');
            $msg->addParam(new xmlrpcval($db, "string"));
            $msg->addParam(new xmlrpcval($id, "int"));
            $msg->addParam(new xmlrpcval($password, "string"));
            $msg->addParam(new xmlrpcval("res.partner","string"));
            $msg->addParam(new xmlrpcval("read", "string"));
            $msg->addParam(new xmlrpcval($ides, "array"));
            $msg->addParam(new xmlrpcval($fields, "array"));

            $res = &$client->send($msg);

$res give : 

xmlrpcresp Object ( [val] => xmlrpcval Object ( [me] => Array ( [array] => Array ( [0] => xmlrpcval Object ( [me] => Array ( [struct] => Array ( [id] => xmlrpcval Object ( [me] => Array ( [int] => 1 ) [mytype] => 1 [_php_class] => ) [name] => xmlrpcval Object ( [me] => Array ( [string] => Delphine Lemire ) [mytype] => 1 [_php_class] => ) [email] => xmlrpcval Object ( [me] => Array ( [string] => delphine.lemire@gmail.com ) [mytype] => 1 [_php_class] => ) ) ) [mytype] => 3 [_php_class] => ) ) ) [mytype] => 2 [_php_class] => ) [valtyp] => phpvals [errno] => 0 [errstr] => [hdrs] => Array ( [content-type] => text/xml [content-length] => 416 [server] => Werkzeug/0.9.4 Python/2.7.6 [date] => Tue, 08 Jul 2014 08:18:01 GMT ) [_cookies] => Array ( ) [content_type] => text/xml )

 

1
Avatar
Cancelar
Thierry Godin
Autor

Oh sorry Delphine, You were right. My fault. I had to write "array" instead of "struct". Thanks a lot for your help ;o)

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Ripcord PHP Fata Error
php
Avatar
Avatar
1
set. 20
5503
Can get only the name of product when reading via API and PHP
api php read product.product
Avatar
0
mar. 15
6164
Call on_change from PHP XML-RPC
php
Avatar
Avatar
1
mar. 15
8081
help installing phpxmlrpc on IIS
php
Avatar
1
mar. 15
6162
Jsonb read
read jsonb
Avatar
0
out. 24
1657
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now