I have been literally banging my head on the desk for days on this one. My create account xml request works fine, but my incident xml request doesnt work.
Here it is below, any help would be greatly appreciated.
$accountsRequest = EntityUtils::getCreateCRMSoapHeader($CRMURL, $securityData).
'
<s:Body>
<Create xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services">
<entity xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<b:KeyValuePairOfstringanyType>
<c:key>ownerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $ownerid . '</c:value>
<c:key>customerid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $customerid . '</c:value>
<c:key>subjectid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $subjectid . '</c:value>
<c:key>title</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $title . '</c:value>
<c:key>new_surveyid</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_id . '</c:value>
<c:key>new_leadsource</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_leadsource . '</c:value>
<c:key>new_forename</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_forename . '</c:value>
<c:key>new_surname</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_surname . '</c:value>
<c:key>new_company</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_company . '</c:value>
<c:key>new_email</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_email . '</c:value>
<c:key>new_phone</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_phone . '</c:value>
<c:key>new_datetravel</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_datetravel . '</c:value>
<c:key>new_drivername</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_drivername . '</c:value>
<c:key>new_punctuality_pickup</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_punctuality_pickup . '</c:value>
<c:key>new_punctuality_dropoff</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_punctuality_dropoff . '</c:value>
<c:key>new_interior</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_interior . '</c:value>
<c:key>new_exterior</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_exterior . '</c:value>
<c:key>new_courtesy</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_courtesy . '</c:value>
<c:key>new_appearance</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_appearance . '</c:value>
<c:key>new_comments</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_comments . '</c:value>
<c:key>new_survey_date</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_date . '</c:value>
<c:key>new_survey_score</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">' . $new_survey_score . '</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>incident</b:LogicalName>
<b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
</entity>
</Create>
</s:Body>
</s:Envelope>
';
I answered my own question - the XML wasn't correctly formed - problems with namespaces mainly. Plus a couple of type issues with CRM Incident fields. Couldn't have done this without the prompters from above so thanks guys. XML below for anyone getting stuck in future.
customerid 6caff60a-f77c-e211-b2fb-d48564518ccb account
<b:KeyValuePairOfstringanyType>
<c:key>title</c:key>
<c:value i:type="d:string" xmlns:d="http://www.w3.org/2001/XMLSchema">Its a sunday web case - second</c:value>
</b:KeyValuePairOfstringanyType>
</b:Attributes>
<b:EntityState i:nil="true"/>
<b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
<b:Id>00000000-0000-0000-0000-000000000000</b:Id>
<b:LogicalName>incident</b:LogicalName>
<b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
</entity>
</Create>