?
Solved

.NET Web Service Expose Namespace

Posted on 2010-01-11
4
Medium Priority
?
626 Views
Last Modified: 2012-05-08
I'm trying to set up a VB.NET 3.5 web service project in Visual Studio. My goal is to include a namespace in this web service that I can expose to web applications that references this web service.

As you can see below, I have added the namespace "MyWebservices", but I am not able to find it after referencing the web service in a client application.

Service1.asmx.vb:

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

Namespace MyWebservices

 ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
 ' <System.Web.Script.Services.ScriptService()> _
 <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
 <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
 <ToolboxItem(False)> _
 Public Class Service1
  Inherits System.Web.Services.WebService

  <WebMethod()> _
  Public Function HelloWorld() As String
   Return "Hello World"
  End Function

 End Class
End Namespace

Service1.asmx:

<%@ WebService Language="VB" CodeBehind="Service1.asmx.vb" Class="WebService1.MyWebservices.Service1" %>
0
Comment
Question by:kikuchiyosesa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 26314249
msdn:
In order for a Web service to be accessed from script, it must be an .asmx Web service whose Web service class is qualified with the ScriptServiceAttribute attribute.

check http://msdn.microsoft.com/en-us/library/bb398998.aspx
0
 

Author Comment

by:kikuchiyosesa
ID: 26315358
I have uncommented the ScriptService attribute, but I am still unable to use the namespace ("MyWebservices") in my referencing winform application.

Note:  I am connecting to my web service from a vb.net 3.5 winform.  I am trying to use the web service namespace in my winform app's code.  The link's tutorial does have code that shows that this can be done (e.g. "Samples.AspNet.SimpleWebService.EchoInput"), but their example calls the web service from an asp.net page.
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 26317263
When you reference a web service, you aren't really referencing it in the same manner that you would an assembly.  The reference does a little background magic and builds a proxy class that converts the low level http/xml stuff into high level function calls.  This proxy class will not utilize the namespaces present in the code behind of the web service.
0
 

Author Comment

by:kikuchiyosesa
ID: 26317373
Bummer!  I was hoping someone wouldn't say that...  Thanks to both of you for your help.
0

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question