dongluan1743 2019-03-04 13:42
浏览 103

如何在PHP中使用cURL发出SOAP请求(Drupal)

I have been trying to get a SOAP request to work within a custom module for Drupal 7. I am using cURL to make the request within a function. At the moment the page I am using says it us under site maintenance whenever I activate the function. Below is an extract of a function. My question is how I can get the value of the email provided by the SOAP response and place it in a PHP variable? Below is my option for using SimpleXML.

$xml = simplexml_load_string($response);
$namespace = 'http://exacttarget.com/wsdl/partnerAPI';
$soap = $xml->children($namespace);
$subscriber_email = $soap->Body->RetrieveResponseMsg->Results->Properties->Property[2]->Value;

This is the result for SOAP request on its own using SOAP UI that I am trying to parse:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <soap:Header>
      <wsa:Action>RetrieveResponse</wsa:Action>
      <wsa:MessageID>[REMOVED]</wsa:MessageID>
      <wsa:RelatesTo>[REMOVED]</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-715a4a7e-4657-48c7-8b01-612580d331ce">
            <wsu:Created>2019-03-04T12:41:08Z</wsu:Created>
            <wsu:Expires>2019-03-04T12:46:08Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>OK</OverallStatus>
         <RequestID>[REMOVED]</RequestID>
         <Results xsi:type="DataExtensionObject">
            <PartnerKey xsi:nil="true"/>
            <ObjectID xsi:nil="true"/>
            <Type>DataExtensionObject</Type>
            <Properties>
               <Property>
                  <Name>SubscriberID</Name>
                  <Value>[REMOVED]</Value>
               </Property>
               <Property>
                  <Name>FirstName</Name>
                  <Value>[REMOVED]</Value>
               </Property>
               <Property>
                  <Name>Email</Name>
                  <Value>[REMOVED]</Value>
               </Property>
            </Properties>
         </Results>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)