Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Problem accessing the XMLRPC API
 
spdaly
Jr. Member
 
Total Posts:  14
Joined:  2008-07-14
Cincinnati, OH
 

I have a Java application that is connecting to Magento via the XMLRPC API.  Everything works fine on my machine (Mac using MAMP), but goes to pieces on my STAGE and PROD environments (Ubuntu).  I also doesn’t work on another developer’s machine which is also a Mac.

I am using an XMLRPC client (http://ditchnet.org/xmlrpc/) to test connectivity.  When I call login I get no response at all - not even a fault response.  When I put the XMLRPC API URL into a browser I get a faultCode 631.  This is what is expected, becasue the browser isn’t posted a correct XMLRPC call.

The interesting result of the test is that I get the following in my Apache error log on the Ubuntu machines:

[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563
[Wed Jan 28 20
:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563
[Wed Jan 28 20
:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563
[Wed Jan 28 20
:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563
[Wed Jan 28 20
:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563
[Wed Jan 28 20
:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in /var/www/magento/app/Mage.php on line 562
[Wed Jan 28 20:36:26 2009] [error] [client 72.49.126.195] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in /var/www/magento/app/Mage.php on line 563

All the code including .htaccess files are _exactly_ the same.  Everything is in source control and managed pretty tightly. 

My thoughts are that this has to do with permissions, Apache CONF or capitalization (Mac is not case sensitive FS).  But, the error message listed above makes no sense.  Line 562/563 in Mage.php is the Mage::log function.  Why would Mage be trying to log to Config.php???

It might also be a missing dependency. But I downloaded the dependency checker (sorry, can’t find the link right now) and everything checked out.

I could really use some help on this one.  I’m under the gun to get the integration completed and this is the last piece of the puzzle!

 
Magento Community Magento Community
Magento Community
Magento Community
 
spdaly
Jr. Member
 
Total Posts:  14
Joined:  2008-07-14
Cincinnati, OH
 

Here’s some additional information.  I used HTTP Client to simulate the POST to the XMLRPC API.  The reply is below.  I get the same error content that I get in the log.  The correct XMLRPC response is at the bottom.

I’m still not sure what is causing this…

HTTP/1.1 200 OK
Date
Thu29 Jan 2009 13:13:16 GMT
Server
Apache/2.2.8 (UbuntuPHP/5.2.4-2ubuntu5.3 with Suhosin-Patch
X
-Powered-ByPHP/5.2.4-2ubuntu5.3
Set
-Cookiemagento=few903bry468vn8mbxkohkm7sn2554cjexpires=Sat28-Feb-2009 13:13:17 GMTpath=/; domain=stage.wearport.comPHPSESSID=b577a1ead7ef39f928172fc5090e1e72expires=Thu29 Jan 2009 14:13:17 GMTpath=/; domain=stage.wearport.com
Expires
Thu19 Nov 1981 08:52:00 GMT
Cache
-Controlno-storeno-cachemust-revalidatepost-check=0pre-check=0
Pragma
no-cache
Content
-Length3049
Connection
close
Content
-Typetext/html

<br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<
br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<
br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<
br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<
br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<
br />
<
b>Warning</b>:  file_put_contents(/var/www/magento/var/log//var/www/magento/app/code/core/Mage/Api/Model/Config.php) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory in <b>/var/www/magento/app/Mage.php</b> on line <b>562</b><br />
<br />
<
b>Warning</b>:  chmod() [<a href='function.chmod'>function.chmod</a>]No such file or directory in <b>/var/www/magento/app/Mage.php</bon line <b>563</b><br />
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><param><value><string>b577a1ead7ef39f928172fc5090e1e72</string></value></param></params></methodResponse>

I’m

 
Magento Community Magento Community
Magento Community
Magento Community
 
bcelenza
Member
 
Avatar
Total Posts:  44
Joined:  2008-08-27
 

The problem appears to be originating on app/code/core/Mage/Api/Model/Server/Handler/Abstract.php:

public function __construct()
    
{
        set_error_handler
(array(get_class($this), 'handlePhpError'), E_ALL);
    
}

    
static public function handlePhpError($errorCode$errorMessage$errorFile)
    
{
        Mage
::log($errorMessagenull$errorFile);
        if (
in_array($errorCode, array(E_ERRORE_USER_ERRORE_RECOVERABLE_ERROR))) {
            $this
->_fault('internal');
        
}
        
return true;
    
}

$errorFile is not being passed properly. Where is this set? Is it stored somewhere in the configuration?

 
Magento Community Magento Community
Magento Community
Magento Community
 
bcelenza
Member
 
Avatar
Total Posts:  44
Joined:  2008-08-27
 

In regards to that code above.

The parameter $errorFile is defined in PHP’s definition of the function set_error_handler:

$errfile:
The third parameter is optional, errfile , which contains the filename that the error was raised in, as a string.

This $errfile param is then being passed into Mage::log as the file to LOG TO, not the file in which the error occured. Looks like this should be changed to either be part of the error message, and the third parameter being passed to Mage::log should either be removed or changed to something else.

A bug report will be filed for this in a few.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top