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>\n";
print "<br />\n Request : ".htmlspecialchars($soapClient->__getLastRequest());
print "<br />\n 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