Using User control (Web service call ) in SharePoint Web part
Everyone knows how easy it is to use an user control( web service call) in normal ASP.NET application and map it with ObjectDataSource control. But in SharePoint, when ObjectDataSource control is used, it will throw the error "The type specified in the TypeNameProperty can be found". The reason being that the proxy class required to connect with the web service is not available in SharePoint.
This is what we need to do, to make create proxy and make it work
Ø Using WSDL.exe ( found under ..\Program Files\Microsoft SDKs\Windows\v6.0A\bin ) run the command wsdl /out:myProxyClass.cs “https://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL”
Ø Create dll using the proxy cs file. This can be done using CSC.exe ( found under ..\Windows\Microsoft.NET\Framework\vx ) and running the command
csc /out:CodeBehindCompiled.dll /target:library CodeBehind_compiled.cs
Note that there is a space between “csc”, “/out…”, “/target…” and “CodeBehind….”.
Ø Now deploy the dll in the bin folder of the SharePoint web application bin directory ( found under ..\inetpub\wwwroot\wss\virtualdirectories\..\bin)
Ø Add the SafeControl entry for both the web part and the proxy dll in the web.config file.
Ø Have the code for referring the class name of the proxy class for ObjectDataSource.
Ø In the web.config file, give Full trust level
<trust level=”Full” originUrl=””/>
That’s it. Now add the web part in the SharePoint page and you should see the web service data in it !
Comments
- Anonymous
June 05, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/using-user-control-web-service-call-in-sharepoint-web-part/ - Anonymous
June 05, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/using-user-control-web-service-call-in-sharepoint-web-part/ - Anonymous
June 05, 2009
PingBack from http://microsoft-sharepoint.simplynetdev.com/using-user-control-web-service-call-in-sharepoint-web-part/ - Anonymous
June 05, 2009
PingBack from http://microsoft-sharepoint.simplynetdev.com/using-user-control-web-service-call-in-sharepoint-web-part/ - Anonymous
June 05, 2009
PingBack from http://www.anith.com/?p=44685 - Anonymous
June 06, 2009
Why is it that the ObjectDataSource does not work? Is there a way to get around it? Also if I don't have an option to run it with full trust level what can I do?Thanks.