Php magento中的自定义soap api调用出错
我正在使用magento中的soap调用开发自定义api,以将客户从移动应用程序登录到magento,然后重定向回移动应用程序。我在magento中使用默认soap调用创建了客户,但没有用于登录客户的soap函数。我创建了与默认客户创建方法类似的custome api,但获取以下错误 [faultstring]=>函数(“customerCustomerUserlogin”)不是 此服务的有效方法 [faultcode]=>客户端 [faultcodens]=> 下面的代码是我正在使用的Php magento中的自定义soap api调用出错,php,web-services,magento,soap,Php,Web Services,Magento,Soap,我正在使用magento中的soap调用开发自定义api,以将客户从移动应用程序登录到magento,然后重定向回移动应用程序。我在magento中使用默认soap调用创建了客户,但没有用于登录客户的soap函数。我创建了与默认客户创建方法类似的custome api,但获取以下错误 [faultstring]=>函数(“customerCustomerUserlogin”)不是 此服务的有效方法 [faultcode]=>客户端 [faultcodens]=> 下面的代码是我正在使用的 $so
$soapclient = new SoapClient('http://localhost/magento/api/v2_soap/?wsdl');
//$soapclient = new SoapClient('http://localhost/magento/api/soap/?wsdl',$opt);
$session = $soapclient->login('soapapi','devmage123');
$customerId = $soapclient->customerCustomerUserlogin($session, $loginDetails);
以下是我使用的代码:
在customer/etc/api.xml中
<config>
<api>
<resources>
<customer translate="title" module="customer">
<model>customer/customer_api</model>
<title>Customer API</title>
<acl>customer</acl>
<methods>
<userlogin translate="title" module="customer">
<title>Userlogin customer</title>
<acl>customer/userlogin</acl>
</userlogin>
</methods>
<faults module="customer">
<login_invalid>
<code>110</code>
<message>Invalid Username and Password.</message>
</login_invalid>
</faults>
</customer>
</resources>
<acl>
<resources>
<customer translate="title" module="customer">
<userlogin translate="title" module="customer">
<title>Userlogin</title>
</userlogin>
</customer>
</resources>
</acl>
</api>
</config>
在customer/etc/wsdl.xml中
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" 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="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<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/" />
</schema>
</types>
<message name="customerCustomerUserloginRequest">
<part name="sessionId" type="xsd:string" />
<part name="loginDetails" type="typens:ArrayOfString" />
</message>
<message name="customerCustomerUserloginResponse">
<part name="result" type="xsd:int"/>
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="customerCustomerUserlogin">
<documentation>Retrieve customer data</documentation>
<input message="typens:customerCustomerUserloginRequest" />
<output message="typens:customerCustomerUserloginResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="customerCustomerUserlogin">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
</definitions>
检索客户数据
我在上面添加了代码……有人能帮我吗?在api.xml中添加以下内容后,请尝试添加:
<v2>
<resources_function_prefix>
<customerCustomer>customerCustomer</customerCustomer>
</resources_function_prefix>
</v2>
顾客
@chandu\u cp,请提供一些代码。@muk我已经添加了代码。。