From:             tomy at envox dot hr
Operating system: Suse 8.2
PHP version:      4CVS-2004-03-01 (stable)
PHP Bug Type:     XMLRPC-EPI related
Bug description:  system.multiCall does not work

Description:
------------
When building xmlrpc server, system.multiCall method does not work with my
method but works with "built-in" methods such as system.listMethods or
system.methodHelp.



I have tested this on latest CVS snapshots both for PHP4 and PHP5, on Suse
8.2.



In following example I have submitted http request sent to server whose
code is presented in "Reproduce code".

I do not get nay response and HTTP connection to server is dropped.



Calling "built-in" methods such as system.listMethods or system.methodHelp
using system.multiCall works OK.

Calling my method ("contact.select") in a straight fashion (without
system.multiCall) works OK here is request and response with headers:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 317



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>contact.select</methodName>

<params>

 <param>

  <value>

   <struct>

    <member>

     <name>SESSIONID</name>

     <value>

      <string>1234567890</string>

     </value>

    </member>

   </struct>

  </value>

 </param>

</params>

</methodCall>



Response received:



replyLine: HTTP/1.1 200 OK



HEADER : Date: Mon, 01 Mar 2004 12:09:59 GMT

HEADER : Server: Apache/1.3.27 (Linux/SuSE) mod_python/2.7.8 Python/2.2.2
PHP/4.3.5RC4-dev

HEADER : X-Powered-By: PHP/4.3.5RC4-dev

HEADER : Content-Length: 375

HEADER : Connection: close

HEADER : Content-Type: text/xml



<?xml version="1.0" encoding="iso-8859-1"?>

<methodResponse>

<params>

 <param>

  <value>

   <struct>

    <member>

     <name>AUTH</name>

     <value>

      <int>1</int>

     </value>

    </member>

    <member>

     <name>SESSIONID</name>

     <value>

      <string>1234567890</string>

     </value>

    </member>

   </struct>

  </value>

 </param>

</params>

</methodResponse>





Reproduce code:
---------------
<?php

function select_contact($method_name, $params, $app_data)

{

   if (count($params) == 0 || !array_key_exists("SESSIONID", $params[0]))
{

      return array("AUTH" => 0);

   } 

   

   return array("AUTH"=>1, "SESSIONID"=>$params[0]["SESSIONID"]);

} 



$xmlrpc_server = xmlrpc_server_create();

xmlrpc_server_register_method($xmlrpc_server, "contact.select",
"select_contact");

$request_xml = $HTTP_RAW_POST_DATA;



$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml,
array());

header("Content-Type: text/xml");

header("Content-Length: " . strlen($response));

print $response;

xmlrpc_server_destroy($xmlrpc_server);



?>



Expected result:
----------------
XMLRPC request sent to server:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 837



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>system.multiCall</methodName>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <struct>

       <member>

        <name>methodName</name>

        <value>

         <string>contact.select</string>

        </value>

       </member>

       <member>

        <name>params</name>

        <value>

         <array>

          <data>

           <value>

            <struct>

             <member>

              <name>SESSIONID</name>

              <value>

               <string>1234567890</string>

              </value>

             </member>

            </struct>

           </value>

          </data>

         </array>

        </value>

       </member>

      </struct>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodCall>



I would expect response like this:



replyLine: HTTP/1.1 200 OK



HEADER : Date: Mon, 01 Mar 2004 12:09:59 GMT

HEADER : Server: Apache/1.3.27 (Linux/SuSE) mod_python/2.7.8 Python/2.2.2
PHP/4.3.5RC4-dev

HEADER : X-Powered-By: PHP/4.3.5RC4-dev

HEADER : Content-Length: 694

HEADER : Connection: close

HEADER : Content-Type: text/xml



<?xml version="1.0" encoding="iso-8859-1"?>

<methodResponse>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <array>

       <data>

        <value>

         <struct>

          <member>

           <name>AUTH</name>

           <value>

            <int>1</int>

           </value>

          </member>

          <member>

            <name>SESSIONID</name>

            <value>

            <string>1234567890</string>

           </value>

          </member>

         </struct>

        </value>

       </data>

      </array>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodResponse>



Actual result:
--------------
XMLRPC request sent to server:



POST /xmlrpc_server.php HTTP/1.0

Content-Type: text/xml

Content-Length: 837



<?xml version="1.0" encoding="utf-8"?>

<methodCall>

<methodName>system.multiCall</methodName>

<params>

 <param>

  <value>

   <array>

    <data>

     <value>

      <struct>

       <member>

        <name>methodName</name>

        <value>

         <string>contact.select</string>

        </value>

       </member>

       <member>

        <name>params</name>

        <value>

         <array>

          <data>

           <value>

            <struct>

             <member>

              <name>SESSIONID</name>

              <value>

               <string>1234567890</string>

              </value>

             </member>

            </struct>

           </value>

          </data>

         </array>

        </value>

       </member>

      </struct>

     </value>

    </data>

   </array>

  </value>

 </param>

</params>

</methodCall>



After request is sent, HTTP connection is dropped and no response is
received.

-- 
Edit bug report at http://bugs.php.net/?id=27446&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27446&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27446&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27446&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27446&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27446&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27446&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27446&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27446&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27446&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27446&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27446&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27446&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27446&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27446&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27446&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27446&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27446&r=float

Reply via email to