Magento Soap API working locally but not remotely -
i have created custom api magento enterprise 1.11. calling api through soap v1 works fine on local dev environment, unable create calls local environment remote environment.
using php interactive shell on localdev:
php > $client = new soapclient(wsdl_uri,array('trace'=>1)); php > $client->login(api_user,api_key); php > var_dump($client->__getlastresponse()); string(538) "<?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:magento" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"><soap-env:body><ns1:loginresponse><loginreturn xsi:type="xsd:string">f0eec73e49665aaf9cc4a6644fba5dc6</loginreturn></ns1:loginresponse></soap-env:body></soap-env:envelope> i have been able localhost, between 2 local vms running on dev machine. can access methods of custom api without issue.
however, when seek create soap client remote test environment, able create client, phone call $client->login(), or subsequent phone call results in following:
php > $client = new soapclient(remote_wsdl_uri,array('trace'=>1)); php > $client->login(api_user,api_key); php warning: uncaught soapfault exception: [wsdl] soap-error: parsing wsdl: couldn't load 'http://remote_host/index.php/api/index/index/wsdl/1/' : failed load external entity "http://remote_host/index.php/api/index/index/wsdl/1/" in php shell code:1 stack trace: #0 php shell code(1): soapclient->__call('login', array) #1 php shell code(1): soapclient->login(api_user, api_key) #2 {main} php > var_dump($client->__getlastrequestheaders()); string(255) "post /index.php/api/index/index/ http/1.1 host: remote_host connection: keep-alive user-agent: php-soap/5.3.18-1~dotdeb.0 content-type: text/xml; charset=utf-8 soapaction: "urn:mage_api_model_server_handleraction" content-length: 550 php > var_dump($client->__getlastresponseheaders()); string(840) "http/1.1 500 internal service error date: mon, 11 feb 2013 19:06:56 gmt server: apache/2.2.16 (debian) x-powered-by: php/5.3.19-1~dotdeb.0 set-cookie: phpsessid=7uqrcmiv96hroubnb1uu7c7cm6; expires=wed, 13-feb-2013 01:06:56 gmt; path=/; domain=.remote_host; httponly expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache set-cookie: customer=deleted; expires=thu, 01-jan-1970 00:00:01 gmt; path=/; domain=.remote_host; httponly set-cookie: customer_info=deleted; expires=thu, 01-jan-1970 00:00:01 gmt; path=/; domain=.remote_host; httponly set-cookie: customer_auth=deleted; expires=thu, 01-jan-1970 00:00:01 gmt; path=/; domain=.remote_host; httponly content-length: 468 vary: accept-encoding connection: close content-type: text/xml; charset=utf-8 php > var_dump($client->__getlastresponse()); string(468) "<?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:body><soap-env:fault><faultcode>wsdl</faultcode><faultstring>soap-error: parsing wsdl: couldn't load 'http://remote_host/index.php/api/index/index/wsdl/1/' : failed load external entity "http://remote_host/index.php/api/index/index/wsdl/1/" </faultstring></soap-env:fault></soap-env:body></soap-env:envelope> when nail //remote_host/index.php/api/?wsdl standard magento wsdl.
the 2 environments 99.99% identical:
server version: apache/2.2.16 (debian) (both local dev , remote) php 5.3.18 (local dev) 5.3.19 (remote host) apache/php configurations same. code base of operations identicali have scoured intewebs clues, including:
http://www.magentocommerce.com/boards/viewthread/56528/ http://www.magentocommerce.com/wiki/5_-_modules_and_development/web_services/overriding_an_existing_api_class_with_additional_functionality#wsdl unable connect magento soap api v2 due "failed load external entity" magento api soap-error: parsing wsdl: couldn't load '[url]/index.php/api/index/index/?wsdl=1' : couldn't find end of start tag part line 56 http://www.magentocommerce.com/api/soap/introduction.htmli've tried "content-length" header prepare mentioned in sedond-to-last link, , else think of... stumped.
while can load wsdl url (http://remote_host/index.php/api/index/index/wsdl/1/) computer, remote server can't contact via remote_host.
php's soapserver object (used magento's implementation) needs contact wsdl know methods exposed.
for reasons i've never been able figure out, it's mutual network configuration server not have access it's own dns entries. connect server via ssh , seek running next
curl http://remote_host/index.php/api/index/index/wsdl/1/ my guess you'll network timeout or remote_host unknown error. prepare configuration server can access itself, , should start working.
magento soap wsdl
No comments:
Post a Comment