Reputation: 1014
I know it may be duplicate question, but in 2015 release I am facing some issue while getting data.
I have read all blogs related to this subject, but could not make it.
I have followed below steps to get data.
Still I am getting Bad-Request error.
please help. If possible please give some Request sample.
Thanks.
Upvotes: 1
Views: 1580
Reputation: 23310
Here's how to setup requests, make sure you're setup correctly:
Create a SOAP project pointing to http://<organization url>/XrmServices/2011/Organization.svc?wsdl
(you'll have to authenticate)
Create a new request for w/e you need to do
In the request, set Authentication
to NTLM
(provide credentials)
In the request, you'll need three Headers
like this (double-check them if you already have them there):
4.1. SOAPAction
- copy/paste it from the request interface properties
4.2 Accept
- application/xml, text/xml, */*
4.3 Content-Type
- text/xml; charset=utf-8
Provide a well-formed request and go
For example, this is what a RetrieveEntityRequest
looks like (this in particular will return the metadata of the account
entity):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header><a:SdkClientVersion xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">6.0</a:SdkClientVersion></soapenv:Header>
<soapenv:Body>
<Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<request i:type="a:RetrieveEntityRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>EntityFilters</b:key>
<b:value i:type="c:EntityFilters" xmlns:c="http://schemas.microsoft.com/xrm/2011/Metadata">Attributes</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>MetadataId</b:key>
<b:value i:type="ser:guid" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>RetrieveAsIfPublished</b:key>
<b:value i:type="c:boolean" xmlns:c="http://www.w3.org/2001/XMLSchema">true</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>LogicalName</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">account</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true" />
<a:RequestName>RetrieveEntity</a:RequestName>
</request>
</Execute>
</soapenv:Body>
</soapenv:Envelope>
Upvotes: 3