wsdl php soap响应示例

时间:2014-02-03 01:03:15

标签: 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>
    <message name="addSubscriberResponse">
    <part name="error" type="tns:ErrorTypeEnum"/>
 </message>

 <operation name="addSubscriber">
     <input message="tns:addSubscriberRequest"/>
     <output message="tns:addSubscriberResponse"/>
 </operation>

好吗?现在我将一些数据发送到该服务器:

$client = new soapclient('http://mailerlite.com/soapserver.php?wsdl');
$client->addSubscriber('EMtest', 44983, 'name@example.com', 'Name');

此代码目前正在工作......

现在

我有这个:

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();

1 个答案:

答案 0 :(得分:0)

$client = new soapclient('http://mailerlite.com/soapserver.php?wsdl');
$response=$client->addSubscriber('EMtest', 44983, 'name@example.com', 'Name');
echo $response;