【发布时间】:2026-01-21 05:05:01
【问题描述】:
我不确定这是否适合它,但我希望你们中的一些人熟悉 PHP cURL 和 SOAPUI。
我已经成功地使用 SOAPUI 提交了一个 Web 服务请求,但是使用 php 没有运气。 PHP 目前在 30 秒时超时(我也尝试将超时时间提高到 3 分钟)。 SOAPUI 请求大约需要 3 秒才能完成。
如果有人能指出我哪里出错了,将不胜感激!
谢谢
以下是我的 SOAPUI 属性 - 端点是 https://ccws-services.ecollege.com/EnterpriseServices/v2.1/EnterpriseCourse.svc: SOAPUI 请求:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:eclg:coursecopy:enterprisecourse" xmlns:v2="http://CCWS-Services.eCollege.com/EnterpriseServices/Types/v2.1/">
<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:Action>urn:eclg:coursecopy:enterprisecourse:createcoursesection:request</wsa:Action>
<wsa:To>http://ccws-services.ecollege.com/EnterpriseServices/v2.1/EnterpriseCourse.svc</wsa:To>
</soap:Header>
<soap:Body>
<urn:CreateCourseSection>
<urn:createCourseSection>
***REMOVED****
</urn:createCourseSection>
</urn:CreateCourseSection>
</soap:Body>
</soap:Envelope>
我从 SOAPUI 获取 RawRequest 并将其用作 PHP 的 XML 有效负载 ($post_string)。
这是我的 PHP 代码 - 我怀疑错误来自我从 SOAPUI 的操作属性中检索到的 SOAPAction:
define('XML_POST_URL', 'https://ccws-services.ecollege.com/EnterpriseServices/v2.1/EnterpriseCourse.svc');
$headers = array(
'Content-Type: text/xml; charset=utf-8',
'Content-Length: '.strlen($post_string),
'Accept: text/xml',
'Cache-Control: no-cache',
'Pragma: no-cache',
'SOAPAction: urn:eclg:coursecopy:enterprisecourse:createcoursesection:request'
);
/**
* Initialize handle and set options
*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, XML_POST_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4000);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
/**
* Execute the request and also time the transaction
*/
$result = curl_exec($ch);
【问题讨论】:
-
最好试试soapclient
-
你能发布 WSDL 吗?
-
@Swapn14 我试过 Soapclient 但我也没有运气。他们不提供链接到的 wsdl,只有 .svc
-
@Halfwarr code.pearson.com/sites/default/files/…
-
@rawrzors 你在请求属性中使用用户名和密码吗?
标签: php web-services soap curl soapui