Creating BCS to connect to Azure Dataset but not getting any data
-
25 เมษายน 2555 15:07
I've developed a WCF service which should retrieve data from this data set (a free dataset): https://datamarket.azure.com/dataset/d8161344-f755-4a86-83e6-db9a89f06efd
It is deployed as a farm solution. The way I test is with an External List type list on one of my web applications.
I've wrote a method for bypassing the certification validation since I was getting error in the SP logs. In the service constructor I am passing my user ID and Secure Account ID as follows:
_context = new EDREnvironmentalHazardRankContainer(_serviceUri)
{ Credentials = new NetworkCredential(UserId, SecureAccountId) };
// Bypass the certificate
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
However, when opening the list I do not get any data. However, I still get the columns as expected. SharePoint logs do not tell something went wrong (or maybe I am not seeing it).
What am I missing?
ตอบทั้งหมด
-
1 พฤษภาคม 2555 2:20
-
3 พฤษภาคม 2555 13:20
Hi Simon,
Thanks for the replay. I've re-created the WCF service - I've wrote the logic to return directly a list of the items.
List<GetHazardIndexData> listOfHazardAreas = new List<GetHazardIndexData>();
The GetHazardIndexData is my in-memory data object which describes the object returned from the azure query.
Once deployed, I made it work, connecting with SharePoint Designer. However, I'd like to develop a solution (Business Data Connectivity Model) which would create the ECT for me once deployed on the farm.
So, I've created a client solution (of type Business Data Connectivity Model) and added the service reference of the WCF service.
I've setup the BDC model with ReadList and ReadItem entities. And here I am stuck - populate the ReadList and ReadItem methods. Here are the following snippets:
ReadItem(string GeographyId){
hazardIndexStat.GeographyId = GeographyId;
hazardIndexStat.EnviromentalHazardIndex = _client.EnviromentalHazardIndex;
hazardIndexStat.EnviromentalHazardRank = _client.EnviromentalHazardRank;
hazardIndexStat.GeographyName = _client.GeographyName;
hazardIndexStat.Latitude = _client.Latitude;
hazardIndexStat.Longitude = _client.Longitude;
hazardIndexStat.State = _client.State;
hazardIndexStat.ZipCode = _client.ZipCode;
return hazardIndexStat;}public static List<HazardsObject> ReadList(){
List<HazardsObject> hazards = new List<HazardsObject>();
IEnumerable<HazardsObject> q = from value in _client
select value;
foreach (var p in q)
{
HazardsObject hazardsObject = new HazardsObject
{
GeographyId = p.GeographyId,
EnviromentalHazardIndex = p.EnviromentalHazardIndex,
EnviromentalHazardRank = p.EnviromentalHazardRank,
GeographyName = p.GeographyName,
Latitude = p.Latitude,
Longitude = p.Longitude,
State = p.State,
ZipCode = p.ZipCode
};
hazards.Add(hazardsObject);
}
}
The problem is how to define the _client object? It is supposed to be some kind of container. But since my WCF is already returning some results, what kind of object I should reference?