How can I add a web service project using Visual Studio 2010? - web-services

I don't want WCF, I only want web service.
Thank you.

They've obscured it, but it's easy enough:
Right-click on your solution, select Add New Project.
In the Framework selection dropdown, select .NET Framework 3.5
Select the Web installed templates listing and you'll find ASP.NET Web Service Application as the last one in the list.
In other words, you can create one in .NET 3.5, but not 4. Now, that being said, it seems like it may be possible to create a .NET 4 template for VS2010, but I'm not a VS2010 guru, so that's for someone else to elaborate on.
Edited to Add: Somebody else posted a response to your question that was also a good answer, I thought, but they deleted it themselves for some reason. I don't remember their user name. I'll repeat it here.
If you create a new Web Application in the solution, you can then Add New Item, and one of the options under Web is "Web Service" at the very bottom.
The only drawback to this is that besides the web service, you also have the usual default items for a web application, namely default.aspx, about.aspx, global.asax, and site.master, as well as the folders Account, Scripts, and Styles. But you can delete these, so no problem. Also keep in mind that the web.config in the Web Application project will be different from that of the Web Service, and that the assembly bindings for the web service will point to ASP.NET v2 & v3.5 (see its web.config), whereas the service in the web application project will default to ASP.NET v4 (through its project file). I don't know if any negative implications exist for either way of working, though I suspect that both will work just fine.

If you select the framework like mentioned above to 3.5 you can select a web service application. If you want it to be targeted at .NET 4.0 framework, go into my project --> Compile --> Advanced Compile Options --> change the target framework to .net framework 4.
You can also change your compile options to target it at a x64 or x86 (32 bit) server.

web.config in the Web Application project will be different from that of the Web Service, and that the assembly bindings for the web service will point to ASP.NET v2 & v3.5 (see its web.config), whereas the service in the web application project will default to ASP.NET v4 (through its project file). I don't know if any negative implications exist for either way of working, though I suspect that both will work just fine.

Here was my resolution:
Right-click on your project name and select to Add Service Reference.
Select the Advance button at the very bottom.
Select the Add Web Reference button at the very bottom.
Proceed as usual. :)

Related

Need Suggestion on How to get data from SharePoint Online for Windows 8.1 App

I recently working on a Windows 8.1 App, which was developed with C# and XAML. SharePoint Online is used for Data store.
I searched and found that Wictor solution can be used for Authentication. but the problem is that we can not use Wictor solution [http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx] directly as it is built upon .Net framework and Metro Apps are built upon .NetCore.
One possible option is to use WCF service and have whole Wictor solution in WCF service then call WCF service from Windows App. I tested it and it is working fine.
However, I wanted to know what would be the best approach available if I don't want to deploy this WCF separately. In future I have to publish this Win App on Windows store.
Any help will be appreciated.
Thanks

Web service on iis not updated

I deployed a web service to iis 7, it was working all the way right.
Then I wanted to update the code of a web method in the web service.
I recompiled the service and updated the dll in the iis directory with the new one.
My problem is when I invoke the service, it invokes the older code.
I tried changing the number of parameters passed to a web method inside the service, and when invoking it still sees the older parameters which I erased.
Web services after Framework 2.0, are compiled as DLL files by default as far as I know. Normally, this happens when you PUBLISH the website and webservice, or when you use Web Applications.. But in WebServices, Visual Studio compiles the output as DLL. Therefore, you should compile your dll and update on the IIS. Even though you see the CS code files on IIS folder, they are not being used. Only the asmx file (not asmx.cs) are used to map the code in the dll.
I am guessing that the old code is cached. Try restarting IIS. That should cleanup any remnants of the old code.
It seems that you need to update your service reference.
Go to the project who's using the service, left-click the service reference in your solution explorer and finally choose "Update Service Reference".
Maybe I'm wrong and you did it, but as you don't mention that in your question, this is my suggestion.
rebuild the solution, And deploy the service on IIS. It will work definitily

How to config IIS in Windows XP SP2

new to IIS. I have two questions:
After installing IIS, I straightly wen to my browser and typed in http://127.0.0.1. But a user name and password dialog box pops up and I have no idea what to type in. Why IIS asks this information? How can I remove this asking.
I want to put a web service under IIS. The web service is written in C# under .net. Is there any tutorial for this config? I found a tutorial but it is under windows server 2003 and there is an option called web service extension. However, I installed IIS in XP and the UI seems completely different.
FYI, the IIS Management tool I used tells me that it is version 5.
Thank you very much for the help.
[FYI, the question #1 is the kind that is typically better addressed on serverfault.com, I'll answer it as well since it is bundled...]
To resolve 1), i.e. to allow anonymous access to the web site
- Open the IIS management console
Either from Computer management Console, in 'Aervices and Applications'
+ 'Internet Information Service'
or from the control panel + Administrative tools
+ 'Internet Information Service'
- On right pane, navigate to 'Web Sites' + 'Default Web Site'
- Right Click, select 'Properties' in menu.
This brings a squarish dialog with 2 rows of 4 tabs each at the top.
- Select 'Directory Security' tab
- then in the top group named 'Anonymous Access and authentication control',
click 'Edit'
- The dialog that comes up is where you need to check the Anonymous access,
and enter the account credentials for the account which IIS will use, on
behalf of the anonymous users. I recommend you create one account for
this purpose, rather than using yours or some other actual user.
Now, concering 2) i.e. to deploy the web service itself
I think you just need to copy the asmx file into the location where you want the web service to run, and the binary files (dlls) to the bin directory. In other words its just like publishing a regular .NET web app, except that the files (referenced in the URI) are named *.asmx. (you can also make this file the default file for the dirctory).
This of course implies that .NET would be installed on thie machine, adn allowed to work (see the '.NET Application" tab of the web properties dialog.
A final bit of advice: You probably will want to install this webservices in its own Web Site (or Web application) and own directory. Refer to serverfault.com for more detail about this type of tasks. There are very many settings, some of which have repercussion on security or performance --> let the pros tell you ;-)

web service references - dynamic URL

I am currently working on a SharePoint project that needs to use the Lists SharePoint web service (Lists.asmx). Therefore, we need to add a service reference to it in Visual Studio. However, we all develop and test on different virtual machines (with different VM names, URLs, etc.). The QA, Test and Production environments all have different names and URLs as well.
Adding a service reference adds a bunch of references to the URL that was specified when the reference was created (in the app.config. .wsdl, .disco, etc.). This is obviously a problem for us as code that works on one machine won't work anywhere else (which breaks the build and continuous integration) We also have to delete and add the service reference every time we work with code that was checked-in by someone else.
This must be a fairly common problem for people developing Web services so I wondered if there was a way around it. I know you can't really create a "dynamic" web reference, but perhaps the impacts of the URL change could be minimized somehow?
Thanks!
By default, the web-service uses the location where it was initially created. The WebService proxy has a URL property which can be set.
This example shows setting it dynamically: http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx
EDIT:
You're also not limited to using the Add Web Reference feature in Visual Studio. You can use the wsdl.exe tool that ships with the .NET Framework SDK to generate the code file.

Consuming a web service with the Netbeans Platform

I have an application that is written with the NetBeans Platform 5.5. I'm having trouble consuming a web service.
If I create a Java SE application in NetBeans, I can add a web service reference without problem.
Since my application is using the NetBeans Platform, many of the menu choices change. So, I cannot figure out how to add a reference to the web service. I've googled this topic a number of ways but haven't found any pages that deal with consuming a service through the platform. They all talk about consuming a service with a Java SE application.
Changing the application from the Platform architecture is not an option.
Here is a good tutorial for setting up a Feed Reader on NetBeans Platform. It covers some of the configuration issues for using web services
Blog with an entry about making a web services client
I'd be happy to try and give you a more specific answer if you can give information about the service you want to access.
Found this:
Create web service and client using this tutorial
Create library wrapper module for web service client (you don't need to include JAX-WS libs, only your client jar)
In your wrapper module add following dependencies (important):
JAX-WS 2.1 API
JAX-WS 2.1 and JAXB 2.1 Library (for this you have to check Show Non-API Modules in "Add Module Dependency" window)
If you try to build module after these steps it will fail telling you that your module is not friend of "path-to-netbeans"/java2/modules/org-netbeans-modules-websvc-jaxws21.jar.
Right click on JAX-WS 2.1 and JAXB 2.1 Library and choose Edit. Select Implementation Version.
from here.