如何用PHP编写SOAP客户端?

时间:2011-12-13 18:24:56

标签: php soap

需要php中的SOAP客户端的简单代码/建议

示例请求

<soapenv:Envelope
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:sch="http://somewebsite.com/Publisher/schemas">
   <soapenv:Header/>
   <soapenv:Body>
      <sch:GetCampaignsRequest>
         <sch:username>myusername</sch:username>
         <sch:password>mypassword</sch:password>
         <sch:approvaltype>approved</sch:approvaltype>
      </sch:GetCampaignsRequest>
   </soapenv:Body>
</soapenv:Envelope>

我已尝试使用以下PHP代码,但我收到错误

致命错误:第0行的E:\ xampp \ htdocs \ soap \ test.php超出最长执行时间60秒

$params = array('username' => 'username','password' => 'password','approvaltype'=>'approved');

$client=new SoapClient('http://somewebsite.com/Publisher.v1.1/publisher.wsdl', array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));

$result = $client->GetCampaignsRequest($params);
print_r($result);

1 个答案:

答案 0 :(得分:0)

您可以尝试设置更高的执行超时(或无)。

<?php
set_time_limit( 0);
int_set('max_execution_time', 0);