我不确定这是不是合适的地方,但我希望你们中的一些人熟悉PHP和cURL。
我已经成功地使用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,并将它用作$post_string的有效负载。
下面是我的-I代码,怀疑错误来自SOAPAction,我从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); 发布于 2013-06-18 21:15:04
你可以试试这个。这就是我在.php中为使用.php时所使用的。
$envelope = '<soap:Envelope> .... </soap:Envelope>';
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, "https://ccws-services.ecollege.com/EnterpriseServices/v2.1/EnterpriseCourse.svc" );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $envelope);
curl_setopt($soap_do, CURLOPT_VERBOSE, TRUE);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, array("Content-Type: text/xml","SOAPAction: \"/soap/action/query\"", "Content-length: ".strlen($envelope)));
$result = curl_exec($soap_do);我确实暂停了试着连接它。在你的终端上试试,看看它是否适用于你的用户名和密码。
https://stackoverflow.com/questions/17174812
复制相似问题