1

I'm getting a soap error, and I haven't been able to trace it. It is blocking an integration and generally causing havoc. Since it is happening immediately with login, I haven't been able to trace it further.

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Procedure 'loginParam' not present

reflected similarly in the apache error log:

PHP Fatal error:  Procedure 'loginParam' not present in /var/www/html/lib/Zend/Soap/Server.php on line 889

This occurs when trying to log in with a valid username/password (which work on the v1 API):

$api_url_v2 = "https://xxx/api/v2_soap/?wsdl=1";
$cli = new SoapClient($api_url_v2);
$session_id = $cli->login($username, $password);

I've tried flushing my WSDL cache, as suggested here: https://stackoverflow.com/questions/12425909/magento-soap-2-api-fatal-error-procedure-login-not-present

I've also tried modifying my WSI-Compliance settings, to no avail.

Any help would be appreciated.


Additional info: I traced out the incoming client call, and see this... although it certainly doesn't look right to me, I've never been a SOAP guy:

<?xml version="1.0" encoding="UTF-8"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento"><SOAP-ENV:Body><ns1:loginParam/><param1>{SOME_PASSWORD}</param1></SOAP-ENV:Body></SOAP-ENV:Envelope>

The headers look like this:

{"Host":"some-server.com","Connection":"Keep-Alive","User-Agent":"PHP-SOAP\\/5.6.20","Content-Type":"text\\/xml; charset=utf-8","SOAPAction":"\\"\\"","Content-Length":"235"}

So... my username appears to have been lost, and I'm not even sure if it is calling the right thing.

1 Answer 1

1

For your login call, you need to format the passed parameters as an array -

$api_url_v2 = "https://xxx/api/v2_soap/?wsdl=1";
$cli = new SoapClient($api_url_v2, array('trace' => 1));
$session_id = $cli->login(array('username' => $username, 'apiKey' => $password));

The array('trace' => 1) parameter on the SoapClient " enables tracing of request so faults can be backtraced. This defaults to FALSE" src: php docs

This could be useful while experimenting with a new api implementation.

9
  • Both formats should work, but I have tried the array version as well, with the same results on both the client and server. The trace parameter isn't giving me anything different. Worse, this isn't a new implementation... it suddenly stopped working yesterday, even though there have been no changes to the system.
    – John
    May 18, 2016 at 19:16
  • Are you running this from a test script? You should definitely be seeing output from the trace. Also, as an end result do you want the api to be using WSI compliance?
    – AreDubya
    May 18, 2016 at 19:28
  • Yeah, the code is just a test script to communicate with the server. It works properly with the v1 API. I've tried toggling the WSI compliance on and off, and both appear to be broken.
    – John
    May 18, 2016 at 19:30
  • It looks like a v1 call, which won't work with v2. loginParam is actually a parameter for WSI compliant mode - if you don't have a need to use WSI compliance leave it off, it changes the format of basically everything.
    – AreDubya
    May 18, 2016 at 19:33
  • Also, be sure you are clearing the cache after you make changes to the api settings, so that the wsdl is regenerated.
    – AreDubya
    May 18, 2016 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.