respone的wsdl-php-soap示例
这是wsdl的一部分:respone的wsdl-php-soap示例,php,soap,wsdl,Php,Soap,Wsdl,这是wsdl的一部分: <message name="addSubscriberRequest"> <part name="api_key" type="xsd:string"/> <part name="group_id" type="xsd:int"/> <part name="email" type="xsd:string"/> <part name="name" type="xsd:string"/&
<message name="addSubscriberRequest">
<part name="api_key" type="xsd:string"/>
<part name="group_id" type="xsd:int"/>
<part name="email" type="xsd:string"/>
<part name="name" type="xsd:string"/>
</message>
<message name="addSubscriberResponse">
<part name="error" type="tns:ErrorTypeEnum"/>
</message>
<operation name="addSubscriber">
<input message="tns:addSubscriberRequest"/>
<output message="tns:addSubscriberResponse"/>
</operation>
此代码当前正在工作
现在
我有这个:
Return Codes
0: Success - the subscription was successful
1: Invalid email address
100: Invalid API Key
101: Invalid GroupID
201: Is Unsubscribed
202: Is Bounced
现在我怎样才能得到错误代码?
我写了这个代码,但它是错误的
$respone=$client->addSubscriberResponse();
嗨,金安。。。你的代码无效。我以前试过。。我得到了这些错误:(!)可捕获的致命错误:类stdClass的对象无法转换为G:\wamp\www\tax\getTax.php中的字符串。在第3ok行,您的响应是根据wsdl返回tns:ErrorTypeEnum,而不是字符串。这就是它不起作用的原因。我们需要在php代码中创建这种类型的对象,然后将其转换为字符串。我将尝试这个并相应地编辑答案。同时你能从wsdl中粘贴“ErrorTypeEnum”结构吗?请从wsdl中粘贴“ErrorTypeEnum”结构。我需要从你的wsdl中查看EnumTypeNum的结构。
$respone=$client->addSubscriberResponse();
$client = new soapclient('http://mailerlite.com/soapserver.php?wsdl');
$response=$client->addSubscriber('EMtest', 44983, 'name@example.com', 'Name');
echo $response;