2011-12-15 12 views
5

मैं के साथ सी # सोप उपयोग करने के लिए कोशिश कर रहा हूँ। Magento 1.4.2।Magento API v2 पीएचपी त्रुटि

http://localhost/api/v2_soap/?wsdl 

यहाँ मैं विधि catalogProductCreate

तो मैं के साथ कनेक्ट करने का प्रयास देख सकते हैं:

$proxy = new SoapClient('http://localhost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login('xxx', 'xxxxxx'); // user with full access 

$newProductData      = new stdClass(); 
$newProductData->name    = 'Product Name'; 
$newProductData->description  = 'Description'; 
$newProductData->short_description = 'Short Description'; 
$newProductData->websites   = array(138); 
$newProductData->categories   = array(7,15); 
$newProductData->status    = 1; 
$newProductData->price    = 45; 
$newProductData->tax_class_id  = 2; 
$newProductData->weight    = 1; 


$result = $proxy->catalogProductCreate(
    $sessionId,   // Soap Session 
    'simple',   // Product Type 
    4,     // Attribute Set Id (Default) 
    'product-sku',  // Product Sku 
    $newProductData  // Product Data 
); 

लेकिन मैं इस उत्पादन प्राप्त करते हैं:

Fatal error: Uncaught SoapFault exception: [4] Resource path is not callable.

+0

कौन-सा त्रुटि का हिस्सा नहीं आप ठीक से समझ सकते हैं? क्या आप विस्तार से समझा सकते हैं? – hakre

+0

http: // localhost/API/v2_soap /?wsdl इसे अपने ब्राउज़र में खोलें देखें कि कैटलॉग प्रोडक्टक्रेट –

+0

जैसी कोई विधि है या नहीं, मुझे पता है कि मुझे यह तरीका नहीं मिल रहा है ... लेकिन मैं इसे xml में देख सकता हूं ... मैं इसे हल करने के लिए कैसे कर सकता हूं? – Ste

उत्तर

1

यकीन है कि आप कर सकते हैं कि बनाना वह wsdl संसाधन सही है, लेकिन मैं यह भी कहा कि इस मुद्दे में भाग फ्लॉप जब मैं उपयोगकर्ता सेट है भूमिका के तहत सही अनुमतियों तक।

15

(विवरण Magento 1.6.x विशिष्ट हैं, लेकिन तकनीक, नहीं तो विवरण, अन्य संस्करणों के लिए लागू किया जाना चाहिए)

मैं यह सोचते हैं रहा हूँ, अपने कोड नमूने के आधार पर, कि आप PHP ग्राहक कोड का उपयोग कर रहे किसी विधि के अस्तित्व के लिए परीक्षण करने के लिए, जिसे आप अपने सी # एप्लिकेशन से कॉल पर लागू कर सकते हैं?

मान लिया जाये कि ऐसी बात है, तो इसका मतलब है आप PHP पता है, तो आप Magento साबुन सर्वर पीएचपी स्तर पर इस डिबग करने के लिए चाहता हूँ। केवल वर्ग फ़ाइल है कि पैदा करता है कि गलती

app/code/core/Mage/Api/Model/Server/Handler/Abstract.php 

या तो उस फ़ाइल के लिए अस्थायी रूप से और सीधे निम्न लॉगिंग जोड़ें, या कोई codepool ओवरराइड के लिए

app/code/local/Mage/Api/Model/Server/Handler/Abstract.php 

में वर्ग फ़ाइल की एक प्रतिलिपि ड्रॉप है। निम्नलिखित अपवाद

throw new Mage_Api_Exception('resource_path_not_callable') 

यह वही है कि गलती के साथ जवाबी कार्रवाई के लिए Magento साबुन सर्वर का कारण बनता है के लिए है कि वर्ग फ़ाइल में

देखो। उस फ़ाइल में चार स्थान होते हैं। प्रत्येक के ऊपर लॉगिंग कॉल जोड़ें।

Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__)); 
throw new Mage_Api_Exception('resource_path_not_callable'); 

यह आप जानते हैं कि जो गलती आपकी समस्या, जिसमें से आप डिबग और आगे लॉग इन कर सकते खड़ी कर रहा है करने देगा। दो स्थानों से ऐसा हो सकता (फाइल में चार कुल, एक नियमित रूप से कॉल के लिए एक, बहु कॉल के लिए एक और) कर रहे हैं।

टिप्पणियों में संभावित कारणों के साथ, उपस्थिति के क्रम में।

//here magento is attempting to instantiate the "API Model" that will perform 
//the work of your API call. Upon instantiation, it discovers that the model 
//doesn't inherit from Mage_Api_Model_Resource_Abstract, and bails. 
//This is rare for a non-custom API call, but might be caused by a class rewrite 
//gone amuck, or a very hacked system 
try { 
    $model = Mage::getModel($modelName); 
    if ($model instanceof Mage_Api_Model_Resource_Abstract) { 
     $model->setResourceConfig($resources->$resourceName); 
    } 
} catch (Exception $e) { 
    Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__)); 
    throw new Mage_Api_Exception('resource_path_not_callable'); 
} 


//Here Magento's been able to instantiate the $model, and is checking if the method is 
//callable. If not, it bails. Again, for a standard, stock API call this shouldn't 
//be happening, but could be the result of a rewrite gone wrong, or someone hacking an 
//api class to make the method non accesible, or someone hacking the method mapping in api.xml 
if (is_callable(array(&$model, $method))) { 
    if (isset($methodInfo->arguments) && ((string)$methodInfo->arguments) == 'array') { 
     return $model->$method((is_array($args) ? $args : array($args))); 
    } elseif (!is_array($args)) { 
     return $model->$method($args); 
    } else { 
     return call_user_func_array(array(&$model, $method), $args); 
    } 
} else { 
    Mage::Log(sprintf('Line %s in file %s',__LINE__, __FILE__)); 
    throw new Mage_Api_Exception('resource_path_not_callable'); 
} 

चित्रित करें कि क्यों Magento एपीआई त्रुटि फेंक रहा है। यह अक्सर आपके साबुन कॉल में एक प्रकार को इंगित करता है, या आपको अपने PHP सिस्टम

+0

2011-12-16T10: 39: 12 + 00: 00 DEBUG (7): फ़ाइल 2us5/usr/www/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php – Ste

+0

लॉग get_class ($ मॉडल) और $ विधि। शायद आपके पास इस मॉडल में ऐसी विधि नहीं है। –

+0

मुझे यहां एक ही समस्या है (दूसरा अगर)। मैंने मॉडल लॉग किया और मेरी विधि मॉडल की विधि की सूची में है, लेकिन स्पष्ट रूप से कॉल करने योग्य नहीं है। सभी के लिए अनुमति नियम अनुमति। –

0

इस फ़ाइल को magento/project के रूट फ़ोल्डर में रखें ताकि आप Magento की सभी विधियों तक पहुंच सकें।

विचार ... भूमिका के साथ एक वेब सेवा उपयोगकर्ता बनाने के लिए

1

कोशिश का आनंद लें और उन्हें भूमिका 'सभी' तक पहुंच है, को सौंपा। भूमिका संसाधन में भूमिका संसाधन मेनू में विकल्प।

संबंधित मुद्दे