creating web service in VB.NET - vb.net

I have just little background in web and I need to do this task by myself so I will be most grateful for your help
this is what my boss told me to do (as far as I understand) - I have to write a web service server which gets some parameters, check their validity and then insert/update them in a database. All the parameters are delivered together as a packet written in SOAP - WSDL file. I have to do it using vb.NET in Visual Studio 2010. I read a bit about it and if I understand correctly .NET takes care already of the SOAP an WSDL issue, it is transparent to me, isn't it? or should I install or implement anything concerning that? I saw some examples in the net that all you have to do is to implement web_method in the asmx file, is it so? if yes, which parameters will my method get - the whole bunch of 20 parametres supposed to be in the packet? anything I need to declare or to update in order to connect to the DB? Any help will be appreciated - uf the answer is too long I will be happy just to get a pointer to some relevant material I can read and learn.
Thanks a lot

Try reading this MSDN article: it describes how to write a simple Web service by using Visual Basic .NET
Here are the main steps from the linked MSDN article:
Start Visual Studio .NET or Visual Studio.
Create a new Active Server Pages (ASP) .NET Web service project. Name the Web service MathService and point the location to an
appropriate Web server that is running ASP.NET if necessary.
Change the name of the Solution file to MathService for consistency.
Change the name of the default Web service that is created from Service1.asmx to MathService.asmx.
Click Click here to switch to code view in the designer environment to switch to code view.
Change the name of the class from Public Class Service1 to Public
Class MathService.
Define methods that encapsulate the functionality of your service. Each method that will be exposed from the service must be flagged with
a WebMethod attribute in front of it. Without this attribute, the
method will not be exposed from the service.
Click Build on the Build menu to build the Web service.
Browse to the MathService.asmx Web service page to test the Web service. If you set the local computer to host the page, the URL is
http://localhost/MathService/MathService.asmx.

Related

Running .NET Program As A Service

I have a program that is written in VB.NET. It is currently interactive in that the user will click on some buttons on the form and click "GO" and it will do it's stuff.
I would like to set this up via a service on a Windows PC and instead of having user inputs via clicks have all the information in a config file.
It is my understanding that I can set this up as a service with some "parameters" on the call line, etc. and get other information from the config file.
Can someone advise me on how to do this?
Thanks
As far as I'm aware the software must have a ServiceInstaller class to install the service and a Service class that inherits from ServiceBase.
This would enable Windows to install, stop and start the service via the command line and services menu respectively.
Here's a simple example
You will need to make some small changes to convert your program to a Windows Service.
First, you will want to remove the user interface entirely - services shouldn't have a user interface.
You'd then build in the service plumbing required. Visual Studio includes a design experience specifically for creating Windows Services. For details on this, see the Creating a Windows Service Application in the Component Designer.

WebService Within a Web Application

I have this project developed by some goofball who decided to nest a dependent WebService within the Web Application that uses it. This has caused problems with publishing changes because you can't update the WebService without Publishing your changes first, and you can't Publish the changes without the WebService being updated at the publishing location. It's totally paradoxical.
Any suggestions on how to remedy this simply? I'm thinking it might be best to somehow extract the WebService out into a separate project which can be published independently (this is best practice after all, isn't it?). Also note that I have updated the project to .NET 4 which has the option to use a WCF Service instead, however if this would require a major reworking of the project, then I would like to keep things as simple as possible.
It's difficult to provide any code to illustrate this problem, but here is the basic hierarchy of the project.
Solution
Project
WebService
MyService 'This is a reference to the Web Service
Service
MyService.asmx 'This is the actual code for the Web Service
[Other Code Pages within the project]
EDIT: What if I did this? This way they could be compiled and published independently of each other.
Solution
Project - App
Web Reference
MyService 'This is a reference to the Web Service
[Other Code Pages within the project]
Project - Service
Service
MyService.asmx 'This is the actual code for the Web Service
The only remaining decision (assuming this is a recommended approach) would be whether to create a WCF Service Library or WCF Service Application? (Remember, this service is only used by this one app and is not shared by any other).
I would definitely extract the web service into a new project.
In addition, if there is other "shared" code (classes, modules) that is common between the projects, you have a couple of choices, depending on how much code needs to be shared:
1) Link the source files from one project or the other (so that you only have a single physical copy of the class)
2) Create a DLL project that each of the projects references and then move the shared code to that project.
3) (Obviously) Duplicate the code in each project.

How to use SOAP 1.2(request and response) in windows forms

I have never worked with SOAP but now i need to use it to get a XML file or CSV file with a lot of products.
I have searched the internet for some examples and found some but i still don't understand how to use it.
Am i wright that it just sends a XML file to a server and you get back a XML file with the data.
Do i really need to install this so that it works: http://www.microsoft.com/en-us/download/details.aspx?id=11413
And i need to implement it in a windows forms application.
Hope someone can help me with a good tutorial.
You don't need to manually write all the code to do the SOAP communication yourself. The .NET framework and visual studio provide tools to automatically build custom client classes that mimic the interface of the SOAP service, and perform all of the SOAP communication for you. You don't need to install anything special, you just need to right-click on your project in the IDE and choose to add a Web Reference, or a Service Reference.

How to implement Configuration Service 5.0 of the StockTrader 5.0 sample application?

We have a collection of WCF Rest WebServices. Those WebServices are having configuration strings that are now hard coded as constants. We want to be able to change those configuration strings at runtime. A colleague of mine pointed me at the Configuration Service of the StockTrader sample application.
I installed the sample application and looked at working of the application. The Configuration Service is just a little part of the sample application. The documentation of the sample application contains a tutorial for the 'Visual Studio Configuration Service template', wich I followed. After that I found the 'Config Service Technical Guide' in the documentation folder of the sample application, wich contains a sort of action plan on page 12. The actionplan is just a summary what has to be implemented to use Configuration Service, not how it has to be implemented. Above the action plan the reader is referred to the 'Guide to Implementing the Configuration Service 5.0 for .NET Applications and Services'. Only thing after googling: The guide is nowhere to be found..
With the combination of the little actionplan in the technical guide, the comments in the code of the VS Template and the technical guide, I made a start to extract the Configuration Service and try to implement it in a new solution to test it. Now I am stuck with the implementation of the ConfigurationActionsBase. The implementation of the ConfigurationActionsBase persists the changes of the configuration to the database.
Does anyone know where the missing guide is(mentioned in the story
above)?
Does anyone know how to extract the configuration of magic
strings out of the StockTrader sample application?
Does anyone know an alternative solution for our scenario?
With Kind Regards,

Monotouch Web Reference Namespace Issue

I have an ASP.net web service sitting on a server, and I have verified that it works properly via a small test client app in VS.
I went to add it in MonoDevelop to my MT application, (Trying both the ASP.net 2.0 and WCF declarations). Inside the "Add Web Reference" wizard, it finds the web service fine. But when I go to reference it, the app doesn't know it exists.
I went to look at it, and it seems when adding it, the namespace it's assigning to it is the title of my solution (which has spaces in it), but the namespace for each of my .cs files within my app contains no spaces.
Web Service Namespace (that it wont let me change): Ultimate GameDay 2011
MT Application Namespace: UltimateGameday2011.
So I manually went into the reference.cs file and took out the spaces. The app classes then saw my web reference object, but it still won't allow me to access any of its members.
Any help would be greatly appreciated.
Check out the following link http://merbla.blogspot.com/2011/03/monotouch-with-json-using-aspnet-mvc.html
Its not a fix to your problem rather a method of creating web services that MonoTouch more easily works with. In my experience ASMX and WCF services have been problematic when consuming in a Monotouch app.
If all else fails, try using the Silverlight service utility located in your programs folder
e.g. C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Tools\SlSvcUtil.exe