1

I have created shopping website using magento.

Now I want to create Magento Mobile App for same website.

For integrate magento with SOAP API I have write following code :

<?php
try
{
    $proxy = new SoapClient('http://192.168.1.199:8086/index.php/api/v2_soap/?wsdl'); // TODO : change url
    $sessionId = $proxy->login(array('username' => 'myusername', 'apiKey' => 'mypassword')); // TODO : change login and pwd if necessary
    $result = $proxy->catalogCategoryTree($sessionId);
}
catch (Exception $e)
{
    var_dump($e);
}

This code working on live server but not on my local server and return exception as following :

object(SoapFault)#2 (9) { ["message":protected]=> string(11) "Bad Request" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(36) "C:\inetpub\wwwroot\mobile_action.php" ["line":protected]=> int(119) ["trace":"Exception":private]=> array(4) { [0]=> array(4) { ["function"]=> string(11) "__doRequest" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(5) { [0]=> string(692) " df03544f48da6b56fe465c4ad347c22f113 " [1]=> string(54) "http://192.168.1.199:8086/index.php/api/v2_soap/index/" [2]=> string(10) "urn:Action" [3]=> int(1) [4]=> int(0) } } [1]=> array(6) { ["file"]=> string(36) "C:\inetpub\wwwroot\mobile_action.php" ["line"]=> int(119) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(20) "catalogCategoryLevel" [1]=> array(4) { [0]=> string(32) "df03544f48da6b56fe465c4ad347c22f" [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" } } } [2]=> array(6) { ["file"]=> string(36) "C:\inetpub\wwwroot\mobile_action.php" ["line"]=> int(119) ["function"]=> string(20) "catalogCategoryLevel" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(4) { [0]=> string(32) "df03544f48da6b56fe465c4ad347c22f" [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" } } [3]=> array(4) { ["file"]=> string(36) "C:\inetpub\wwwroot\mobile_action.php" ["line"]=> int(42) ["function"]=> string(17) "getMainCategories" ["args"]=> array(2) { [0]=> object(SoapClient)#1 (5) { ["_soap_version"]=> int(1) ["sdl"]=> resource(5) of type (Unknown) ["httpurl"]=> resource(8) of type (Unknown) ["_cookies"]=> array(1) { ["PHPSESSID"]=> array(3) { [0]=> string(26) "mf57nunfbuj8k1q1cjsi8gktr0" [1]=> string(1) "/" [2]=> string(13) "192.168.1.199" } } ["__soap_fault"]=> *RECURSION* } [1]=> &string(32) "df03544f48da6b56fe465c4ad347c22f" } } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(11) "Bad Request" ["faultcode"]=> string(4) "HTTP" }

Please tell me How to integrate SOAP API v2 with local server in magento?

Is there another way to Create API for Mobile APP?

  • your exception log is not related to SOAP API – Minesh Patel Oct 16 '15 at 12:04
  • check magento SOAP example here – Minesh Patel Oct 16 '15 at 12:05
  • Thanks for reply, I have created magento API from this url, but when calling any function it returns either bad request or Parsing Schema error. – Vinaya Maheshwari Oct 16 '15 at 12:18
  • 192.168.1.199:8086 this is live domain ? – Minesh Patel Oct 16 '15 at 12:20
  • No this is local Server. – Vinaya Maheshwari Oct 16 '15 at 12:23
1

Try this login require direct parameter not in array

<?php
try
{
    $proxy = new SoapClient('http://192.168.1.199:8086/index.php/api/v2_soap/?wsdl'); // TODO : change url
    $sessionId = $proxy->login('myusername','mypassword'); // TODO : change login and pwd if necessary
    $result = $proxy->catalogCategoryTree($sessionId);
    echo "<pre>";
    print_r($result);
}
catch (Exception $e)
{
    var_dump($e);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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