Monday, February 13, 2012

About HTTP Endpoint/Web services

Hi All,

I met some problems when I walk through a example for Native Http SOAP in SQL Server 2005 for Developers. after I create the HTTP EndPoint in the Management Studio using following code:

USE AdventureWorks
GO

CREATE PROCEDURE EmployeePhoneList
AS
SELECT C.LastName, C.FirstName, C.Phone
FROM Person.Contact AS C
INNER JOIN HumanResources.Employee AS E
ON C.ContactID = E.ContactID
ORDER BY C.LastName, C.FirstName
GO

DROP ENDPOINT HRService;
GO

CREATE ENDPOINT HRService
STATE = STARTED
AS HTTP
(
PATH='/HumanResources',
AUTHENTICATION=(INTEGRATED),
PORTS=(CLEAR)
)
FOR SOAP
(
WEBMETHOD 'EmployeePhoneList'(name='AdventureWorks.dbo.EmployeePhoneList'),
DATABASE='AdventureWorks',
WSDL=DEFAULT
)

then I can see the web service is indeed created by using following cmnd,

SELECT *
FROM sys.endpoints

SELECT *
FROM sys.soap_endpoints;

SELECT *
FROM sys.endpoint_webmethods;

but when I want to use the web service in the VS2005, I can't find it and add the web reference. Any help will be greatly appreciated. and could you please tell me how to check web services in the local computer? Thanks.

Chris

Did you find your answer? I've been through this a little now and would be happy to help.

If, in Visual Studio, you add a web reference, you'll be asked a location in the form of a URI. In the example that you show, the URI would be something like http://localhost/HumanResources?wsdl, which, when entered, should result in the finding of services and a proposed reference name of localhost ... which you can name to something else. The default namespace that will be created in your VS project will be something like <NameOfYourProject>.localhost ... or whatever you renamed it to be.

If you use an Object Viewer to look at the contents of the namespace, you'll see a couple of clients generated ... one something like HRService, and the other HRServiceWse. From here, I would suggest you follow the link http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=536560&SiteID=1&mode=1, since this picks up from there.

Tom

No comments:

Post a Comment