My first WebService attempt.
I used
http://www.15seconds.com/issue/040708.htm as a starting point.
- Created a new ASP .NET Web Service and ASP .NET Web Application using
VS2003.
(accepting the default names WebService1 and WebApplication1)
- Pasted code from the article mentioned above.
- Replaced some code, for instance:
in WebForm1.aspx:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
and
function init() { // Create an instance of the web service and call it
svcEmployee service.useService("http://localhost/WebService1/Service1.asmx?WSDL","svcEmployee");
}
- Had some difficulties getting it to work because my WebService1 runs on my
local PC, and the Database runs on a server in the network.
Got this error message:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection
Solved by putting
<identity
impersonate="true"
/>
in
<system.web>
in the web.config file of WebService1.
- Used this connection string in <appSettings>
:
<add
key="connectionString"
value="Trusted_Connection=yes;User
ID=RND\abtn;workstation id=PC-ABTN;packet size=4096;integrated security=SSPI;data
source=RDV10T;initial catalog=Northwind"/>
- The Web Service Behavior file must be placed in the directory of WebApplication1 and can be found at
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/samples/internet/behaviors/library/webservice/default.asp
See also