Thursday, September 30, 2010

ASMX Web Service as Service Reference in VS 2010

This was an interesting thing I observed.

I started a new project on VS 2010 & .Net 4.0. For some data I had to connect to the Web Service that was build with early version of .Net framework. So I added the web service as a "Service Reference" in my project.

The web service in question has 4 overloaded search methods with "MessageName" attributes set to "search1", "search2" etc. {Not very intuitive, I know, but that's the way it is}. The one I wanted to call has the MessageName "search4".

Now when I go to my ASPX page to call the web method, I was confused not to find "search4" method listed in the intellisense. It would give me an error if I type down the method name. All the while I could see the "search4" method through my web browser.

After a bit of digging into the associated files created for each service reference, I found that in "Reference.cs" under "Reference.svcmap" this line of code:

// CODEGEN: Generating message contract since the wrapper name (search4) of message search4 does not match the default value (search3)

[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/search4", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
NS.MyProject.WS_Test.search41 search3(NS.MyProject.WS_Test.search4 request);


The auto generated code explanation sounded a bit weird to me. Expose the method as it was intended by the Web service developers. Why rename them?

Monday, September 27, 2010

An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available.Hresult:Hresult: 0x80040E4D Description: "Login failed for user '

Error:
"DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D Description: "Login failed for user ''."

This error is interesting in that the user name and credentials are entered correct in the SSIS Connection but you still get this error.

There are whole lot of reasons you may find on Internet. But no one sequence worked for me. What made this go away in my package was:
a.) Set "DelayValidation" to true, as I was seeking connection at run time from database/xml file.
b.) Set "Protection Level" property to "EncryptSensitiveWithPassword" and provide a package password.

I found a good explanation for various causes, though unrelated to my issue, here:
http://blogs.msdn.com/b/dataaccesstechnologies/archive/2009/11/09/ssis-error-code-dts-e-oledberror-an-ole-db-error-has-occurred-reasons-and-troubleshooting.aspx

Wednesday, September 1, 2010

Could not find default endpoint

This was a weird error I got while trying to consume a WCF service in my web application.
Could not find default endpoint element that references contract 'WS_User.IUser' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.


My project setup was so that the service reference was made in a class library whose method, user authentication, was invoked by the web application. So the solution to this problem was that I had to have the binding information at two places:
a.) The class library that was making the call to WCF service, and
b.) The web application that was making a call to the method in class library.

A bit weird behavior in my view, but that did away with the issue.