Solved

How is an .ASMX Generated by VB.NET?

Posted on 2010-11-10
7
696 Views
Last Modified: 2012-08-14
Here is what I so far know:

1- add this code to each web service class:

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

' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class AdminBudget
    Inherits System.Web.Services.WebService

2-set-up web service methods like so:

    <WebMethod()> _
    Public Function PositionPerPositionCD(ByVal strPositionsCD As String) As String()

3- create a .ASMX using the class name:

VB.NET genrates this:
<%@ WebService Language="VB" Class="AdminBudget" %>

On-line help states it should be this:
<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

(not certain of which is correct)

As far as I was informed by a co-worker, all that is left is building the project. However, the .ASMX file remains empty outside of the above directive.

What am I missing? My co-worker is not here and I need to finish this by this coming Monday (11-15). Any help will be appreciated. Thank you.

-Bob
0
Comment
Question by:bobcann
  • 3
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 34111942
What I would suggest is to create a new "Hello World" web service from the project template, and look at what the template generates, and compare to what you need for your web service.
0
 
LVL 21

Assisted Solution

by:Craig Wagner
Craig Wagner earned 150 total points
ID: 34111947
The ASMX file should be empty outside of that directive. The code goes in the code-behind file.

The directive from the on-line help is correct.

Rather than creating these files from scratch, why don't you just right-click on the project in Solution Explorer, Add->New Item->Web->Web Service and let it generate all the stub files? If, for some reason, that option isn't available, as an alternative you could use File->New Project->Web->ASP.NET Web Service Application and then copy the generated stub files into your project. Hand-crafting these files isn't necessary when Visual Studio will generate them for you.
0
 

Author Comment

by:bobcann
ID: 34121875
Hi Guys,

This is what is in the VB generated .asmx file.

<%@ WebService Language="VB" Codebehind="AdminBudget.vb" Class="AdminBudget" %>

It did not work. The file name was changed from "Codebehind="AdminBudget.vb" to "Codebehind="AdminBudget.asmx.vb" altering it to ".asmx.vb"

<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

When I build the project the asmx files are not populated with code as my co-worker explained (not at work today).

What am I missing. Thanks again for your help!

-Bob
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 34122457
Are you able to attach a screen cast of your problem?
0
 

Author Comment

by:bobcann
ID: 34123871
TheLearnedOne, as I was creating a Screncast, I believe I found my error. It was explained by my co-worker that by simply Building the project would create the appropriate Service files. Out of ingnorance, I did so.

However, this time I selected Build > Publish Web Site and it asked for a directory to place the files in. It all seemed to work just fine.

One last question, the .asmx files only contain the directive:

<%@ WebService Language="VB" Codebehind="AdminBudget.asmx.vb" Class="AdminBudget" %>

Is this correct that it only contains this single line of code?

The client programmer will not be in until Monday and he is needed to test the function of the completed Web Service.

Again, thank you for the help.

-Bob
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 350 total points
ID: 34127834
All the heavy lifting, in a web service, is in the code-behind, so the .asmx file only needs to declare that class for the ASP.NET parser.
0
 

Author Closing Comment

by:bobcann
ID: 34138482
Thanks for the help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now