doumingo04696 2015-04-03 16:04
浏览 59

带头的PHP复杂SOAP请求

Been trying to get a XML SOAP request converted into PHP. This is my first time writing a SOAP request. I'm familiar with PHP but not having any luck. Here's the XML Request I have to replicate:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:cap="http://services.urbanscience.com/captureservice" xmlns:data="http://www.urbanscience.com/els/orchestration/data">
<soap:Header>
  <cap:SecurityIdentity>         
     <data:ApplicationId>1</data:ApplicationId>         
     <data:ClientId>1</data:ClientId>         
     <data:UserId>7</data:UserId>
  </cap:SecurityIdentity>
  <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://services.urbanscience.com/captureservice/ICaptureService/DispositionRequest</wsa:Action>
  <cap:ApplicationId>1</cap:ApplicationId>         
  <cap:ClientId>1</cap:ClientId>         
  <cap:UserId>7</cap:UserId>
</soap:Header>
<soap:Body>
  <cap:CaptureRequest>         
<cap:RawXml>
    <ArrayOfDispositionActivity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <DispositionActivity>
           <!--Comes from DocumentId in the delivered lead -->
           <UsaiId>165</UsaiId>
           <!--Can be any id this is not validated by Urban Science-->
           <LmsId>1946</LmsId>
           <ReceivedDateTime>2015-03-16T10:59:13.5399397-04:00</ReceivedDateTime>
           <ActivityDateTime>2015-03-16T11:34:37.0015824-04:00</ActivityDateTime>
           <!--Predefined values that come from the C4 spec document-->
           <ActivityType>Called Customer</ActivityType>
           <!--Can be any username, this is not validated by UrbanScience-->
           <UserName>Alex</UserName>               
           <LmsSource>HASCO</LmsSource>
        </DispositionActivity>
    </ArrayOfDispositionActivity>
</cap:RawXml>
  </cap:CaptureRequest>
</soap:Body>
</soap:Envelope>

The WSDL is https://braunabilityels.usaitechdev.com/C4CaptureService/services/captureservice.v1.soap.svc?singleWSDL

This is what I have so far, but I keep getting this error:

Uncaught SoapFault exception: [HTTP] Error Fetching http headers

My PHP code:

$soapClient = new SoapClient("https://braunabilityels.usaitechdev.com/C4CaptureService/services/captureservice.v1.soap.svc?singleWSDL");
$user_param = array (
    'ApplicationId' => "1",
    'ClientId' => "1",
    'UserId' => "7"
);
$header_param = array (
    'SecurityIdentity' => $user_param,
     'ApplicationId' => "1",
    'ClientId' => "1",
    'UserId' => "7"
);

$header = new SoapHeader('http://services.urbanscience.com/captureservice','Auth',$header_param,false);
$soapClient->__setSoapHeaders($header);

$data_param = array (
    'UsaiId' => "165",
    'LmsId' => "1946",
    'ReceivedDateTime' => "2015-03-16T10:59:13.5399397-04:00",
    'ActivityDateTime' => "2015-03-16T11:34:37.0015824-04:00",
    'ActivityType' => "Called Customer",
    'UserName' => "Alex",
    'LmsSource' => "HASCO"
);

$disposition_param = array (
    'DispositionActivity' => $data_param,
);

$xml_param = array (
    'RawXml' => $disposition_param,
);

$capturereq_param = array (
    'CaptureRequest' => $xml_param,
);

  print_r($soapClient->__soapCall("DispositionRequest",array($capturereq_param)));

print "<pre>
";
print "<br />
 Request : ".htmlspecialchars($soapClient->__getLastRequest());
 print "<br />
 Response: ".htmlspecialchars($soapClient->__getLastResponse());
print "</pre>";

I've worked through it several different ways but I end up stuck always getting the Fetching http headers error in my PHP log. I've successfully tested to other SOAP services so my thought is it has something to do with this request having multiple Requests under the main Capture Service and I'm not passing the information correct. I haven't been able to find any examples that look like this.

My version of PHP is 5.4.24 The SOAP Application is 1.2

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!