.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

WebReference v/s ServiceReference

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :SharePoint
 
Hi, I'm trying to access the sql database through webservice in my wsp builder project code for custom webpart. The web part or code is not throwing any error when i check it on our server but it generates error on client's machine. I've developed the code using WSP Builder project in Visual Studio 2008 using Add Web Reference option to add web reference. WebReference.myWebReferenceName myService = new WebReference.myWebReferenceName(); NetworkCredential nc = new NetworkCredential(); nc.Domain = myDomain; nc.UserName = myUser; nc.Password = myPassword; CredentialCache myCache = new CredentialCache(); myCache.Add(new Uri(myWebService), "Ntlm", nc); myService.Credentials = myCache.GetCredential(new Uri(myWebService), "NTLM"); In another code, i've developed using Class Library project in Visual Studio 2008 using Add Service Reference to add web service reference. This code is not throwing error on client machine as well. WPDBService.myWebServiceClient myService = new WPDBService.myWebServiceClient(); NetworkCredential nc = new NetworkCredential(); nc.Domain = myDomain; nc.UserName = myUser; nc.Password = myPassword; CredentialCache myCache = new CredentialCache(); myCache.Add(new Uri(myWebService), "Ntlm", nc); myService.ClientCredentials.Windows.ClientCredential = myCache.GetCredential(new Uri(myWebService), "NTLM"); So,


View Complete Post


More Related Resource Links

add a webreference that displays error An unexpected error occurred on a send. Received an unexpecte

  
this problem is driving me crazy..... i need to add this web reference to a webservice develeped using oracle jdeveloper, but it thows.. There was an error downloading 'https://farmpruebas1.sat.gob.gt/web/ConsultasPublicasSW?WSDL'.The underlying connection was closed: An unexpected error occurred on a send.Received an unexpected EOF or 0 bytes from the transport stream.There was an error downloading 'https://farmpruebas1.sat.go DO I HAVE TO CHANGE SOMETHING IN THE WEB.CONFIG  

How to pass the servicename and namespace dynamically for dynamic webreference - asmx

  

We have number of asmx services. I want to give an user a page with a textbox to input service url like http://abc.win.com/myservice/customerdata.asmx. When user hit "Load" button, dynamically I add all the web methods to the dropdown.

I was able to find a way to generate the proxy and the list of all the methods using this helpful link: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/39138d08-aa08-4c0c-9a58-0eb81a672f54

But, I found that I have to know the serviceName and the namespace beforehand to make this work. In real scenario, user will just enter any asmx, how will I know the namespace and the service name of the selected service upfront? Can I extract that too dynamically so that I don't need to change the code or build a list of all the namespaces and servicenames?


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend