SharePoint 2010 – Gripes, Groans and Gremlins


Introduction

I’ve been trying to get ADOMD, or AMO, to work from a BDC in SharePoint 2010. I’ve been building the BCD in Visual Studio, which has been working quite well. The problem I ran into was getting an exception when trying to open the connect to Analysis Services on another server.

Gremlins

The exception  I was getting was:

A first chance exception of type 
'Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException' occurred in
Microsoft.AnalysisServices.AdomdClient.dll Microsoft.AnalysisServices.AdomdClient.AdomdConnectionException:
The connection either timed out or was lost. --->
System.IO.IOException: Unable to read data from the transport connection:
An existing connection was forcibly closed by the remote host. --->
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) at Microsoft.AnalysisServices.AdomdClient.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length) at Microsoft.AnalysisServices.AdomdClient.DimeRecord.ReadHeader() at Microsoft.AnalysisServices.AdomdClient.DimeReader.ReadRecord() at Microsoft.AnalysisServices.AdomdClient.TcpStream.GetResponseDataType() --- End of inner exception stack trace --- at Microsoft.AnalysisServices.AdomdClient.XmlaClient.EndRequest() at Microsoft.AnalysisServices.AdomdClient.XmlaClient.CreateSession(
ListDictionary properties, Boolean sendNamespaceCompatibility) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.
Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.CreateSession(
Boolean sendNamespaceCompatibility) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open() at AnalysisServicesCubesBDCModel.BdcModel1.SharePointCubeDetails.PopulateListOfCubes()

Which seems to suggest that the client is getting kicked off the server. Or, my connection was being rejected by the Analysis Services Server. This diagnosis proved to be incorrect!

It turned out that SharePoint was also shutting down the connection. NB: Both ADOMD and AMO are probably using the Analysis Services Web Service “under the covers” to get the information.

How to get SharePoint to let the Analysis Services Web Services Call happen?

Solution and Gripe!

Once the “penny dropped” that it was SharePoint “stopping” the connection, a bit of browsing the SharePoint class libraries yielded the following solution.

public static IEnumerable<Cars> ReadList()
 {
 //TODO: This is just a sample. Replace this simple sample with valid code.
 IEnumerable<Cars> carsList = null;
 Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(delegate()
 {
 carsList = Cars.GetList();
 });

 return carsList;
 }
Gripe: I don’t like embedding a “wholesale” privilege elevation in a system. 

I’ll have to look more deeply into SharePoint application security to see if there is a more finer grained way of controlling the security context of an application.

GROAN !

As part of the implementation of the linkage between Analysis Services and SharePoint, I had in mind pass into SharePoint some URL’s. So in the BDC designer in Visual Studio 2010, I tried to use the URI type.

The following is a screen garb of the types which the BDC “supports”:clip_image002

You can “scratch” Uri. I created a property on the Object being passed back of type Uri. The added that property into the BDC definition. When the BDC was mapped into SharePoint as an External List, the property did not appear (no error, just plain missing in action).

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Windows Live Tags: SharePoint 2010,Gripes,Groans,Gremlins,ADOMD,Visual Studio,exception,Analysis Services,server,Microsoft,AnalysisServices,AdomdClient,AdomdConnectionException,connection,System,IOException,Unable,data,Sockets,SocketException,NetworkStream,Read,Byte,size,BufferedStream,DimeRecord,ForceRead,Stream,length,ReadHeader,DimeReader,ReadRecord,TcpStream,GetResponseDataType,XmlaClient,EndRequest,CreateSession,ListDictionary,properties,Boolean,AdomdConnection,XmlaClientProvider,IXmlaClientProviderEx,ConnectToXMLA,Open,AnalysisServicesCubesBDCModel,SharePointCubeDetails,PopulateListOfCubes,client,diagnosis,Service,information,Call,Solution,Gripe,libraries,IEnumerable,Cars,ReadList,RunWithElevatedPrivileges,GetList,elevation,context,GROAN,Object,definition,External List,csharpcode

Digg This

Advertisements

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: