Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

xmlrpc PHP: need a functional "read" example

Odoberať

Get notified when there's activity on this post

This question has been flagged
phpread
1 Odpoveď
11064 Zobrazenia
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
Zrušiť
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
Best Answer

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
Zrušiť
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)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
Ripcord PHP Fata Error
php
Avatar
Avatar
1
sep 20
5505
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
8082
help installing phpxmlrpc on IIS
php
Avatar
1
mar 15
6164
Jsonb read
read jsonb
Avatar
0
okt 24
1657
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

Website made with

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