Solved

How is an .ASMX Generated by VB.NET?

Posted on 2010-11-10
7
699 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

807 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