Solved

How is an .ASMX Generated by VB.NET?

Posted on 2010-11-10
7
702 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
[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
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

630 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