dsm0688 2015-08-11 20:58
浏览 82

SoapClient致命错误Magento SOAP API

I'm trying to run a method i created on Codeigniter and run it via Cli Cron

Cron line: php /home/path/to/ci/index.php controller method

inside the method i have a a SoapClient function that connect to a Magento webservices, running it on the web works like charm, but running on Cron with php it give me this error:

Type: SoapFaultMessage: SoapClient::SoapClient(): 'uri' option is required in nonWSDL modeFilename:

Type: SoapFaultMessage: SoapClient::SoapClient(): 'location' option is required in nonWSDL modeFilename:

As i understand it needs an uri and location in the SoapClient function.

i added this 2 parameters but it still need one more, and i don't know what parameter is:

Type: SoapFaultMessage: Required parameter is missing

is there a way to create a SoapClient with nonWSDL for Magento?

Magento connection:

$client = new SoapClient('http://www.magento.com/api/soap/?wsdl=1', array('trace' => true, 'uri' => 'urn:Magento', 'location' => 'http://www.magento.com/api/'));
$session = $client->login('userApi', 'apiKey');
$getAttributes = $client->call($session, 'catalog_product_attribute.options', '11');
var_dump($getAttributes );
$client->endSession($session);

XML Soap Structure:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="Magento" targetNamespace="urn:Magento">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<!--
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
-->
<complexType name="FixedArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</types>
<message name="call">
<part name="sessionId" type="xsd:string"/>
<part name="resourcePath" type="xsd:string"/>
<part name="args" type="xsd:anyType"/>
</message>
<message name="callResponse">
<part name="callReturn" type="xsd:anyType"/>
</message>
<message name="multiCall">
<part name="sessionId" type="xsd:string"/>
<part name="calls" type="typens:FixedArray"/>
<part name="options" type="xsd:anyType"/>
</message>
<message name="multiCallResponse">
<part name="multiCallReturn" type="typens:FixedArray"/>
</message>
<message name="endSession">
<part name="sessionId" type="xsd:string"/>
</message>
<message name="endSessionResponse">
<part name="endSessionReturn" type="xsd:boolean"/>
</message>
<message name="login">
<part name="username" type="xsd:string"/>
<part name="apiKey" type="xsd:string"/>
</message>
<message name="loginResponse">
<part name="loginReturn" type="xsd:string"/>
</message>
<message name="resources">
<part name="sessionId" type="xsd:string"/>
</message>
<message name="resourcesResponse">
<part name="resourcesReturn" type="typens:FixedArray"/>
</message>
<message name="globalFaults">
<part name="sessionId" type="xsd:string"/>
</message>
<message name="globalFaultsResponse">
<part name="globalFaultsReturn" type="typens:FixedArray"/>
</message>
<message name="resourceFaults">
<part name="resourceName" type="xsd:string"/>
<part name="sessionId" type="xsd:string"/>
</message>
<message name="resourceFaultsResponse">
<part name="resourceFaultsReturn" type="typens:FixedArray"/>
</message>
<message name="startSession"/>
<message name="startSessionResponse">
<part name="startSessionReturn" type="xsd:string"/>
</message>
<portType name="Mage_Api_Model_Server_HandlerPortType">
<operation name="call">
<documentation>Call api functionality</documentation>
<input message="typens:call"/>
<output message="typens:callResponse"/>
</operation>
<operation name="multiCall">
<documentation>Multiple calls of resource functionality</documentation>
<input message="typens:multiCall"/>
<output message="typens:multiCallResponse"/>
</operation>
<operation name="endSession">
<documentation>End web service session</documentation>
<input message="typens:endSession"/>
<output message="typens:endSessionResponse"/>
</operation>
<operation name="login">
<documentation>Login user and retrive session id</documentation>
<input message="typens:login"/>
<output message="typens:loginResponse"/>
</operation>
<operation name="startSession">
<documentation>Start web service session</documentation>
<input message="typens:startSession"/>
<output message="typens:startSessionResponse"/>
</operation>
<operation name="resources">
<documentation>List of available resources</documentation>
<input message="typens:resources"/>
<output message="typens:resourcesResponse"/>
</operation>
<operation name="globalFaults">
<documentation>List of resource faults</documentation>
<input message="typens:globalFaults"/>
<output message="typens:globalFaultsResponse"/>
</operation>
<operation name="resourceFaults">
<documentation>List of global faults</documentation>
<input message="typens:resourceFaults"/>
<output message="typens:resourceFaultsResponse"/>
</operation>
</portType>
<binding name="Mage_Api_Model_Server_HandlerBinding" type="typens:Mage_Api_Model_Server_HandlerPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="call">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="multiCall">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="endSession">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="login">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="startSession">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="resources">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="globalFaults">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="resourceFaults">
<soap:operation soapAction="urn:Mage_Api_Model_Server_HandlerAction"/>
<input>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:Magento" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="MagentoService">
<port name="Mage_Api_Model_Server_HandlerPort" binding="typens:Mage_Api_Model_Server_HandlerBinding">
<soap:address location="https://www.magento.com/index.php/api/soap/index/"/>
</port>
</service>
</definitions>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求数学坐标画圆以及直线的算法
    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决