How to create web service (server & Client) in Visual Studio 2012? - web-services

How to create web service (server & Client) in Visual Studio 2012?
like being done before 2012 as
http://www.tutorialspoint.com/asp.net/asp.net_web_services.htm

When creating a New Project, under the language of your choice, select Web and then change to .NET Framework 3.5 and you will get the option of creating an ASP.NET WEB Service Application.

Create a new empty Asp.NET Web Application.
Solution Explorer right click on the project root.
Choose the menu item Add-> Web Service

WCF is a newer technology that is a viable alternative in many instances. ASP is great and works well, but I personally prefer WCF. And you can do it in .Net 4.5.
Create a new project.
Right-Click on the project in solution explorer, select "Add Service Reference"
Create a textbox and button in the new application. Below is my click event for the button:
private void btnGo_Click(object sender, EventArgs e)
{
ServiceReference1.Service1Client testClient = new ServiceReference1.Service1Client();
//Add error handling, null checks, etc...
int iValue = int.Parse(txtInput.Text);
string sResult = testClient.GetData(iValue).ToString();
MessageBox.Show(sResult);
}
And you're done.

--- create a ws server
vs2012 upd 3
new project
choose .net framework 3.5
asp.net web service application
right click on the project root
choose add service reference
choose wsdl
--- how can I create a ws client from a wsdl file?
I´ve a ws server Axis2 under tomcat 7 and I want to test the compatibility

Related

WCF Service in Windows Phone Silverlight 8.1 Project

I cannot seem to access my WCF Service from Windows Phone Silverlight 8.1 application.
I am able to add a service reference, like for example in a console applications, but the following code does not work
ServiceReference1.MojaSmetkaWcfClient client = new MojaSmetkaWcfClient();
var result = client.GetData(0);
It says 'Cannot resolve symbol ServiceReference1'.
This works in a console app project. How can I connect to the WCF service. If it is not possible, are there any alternatives similar to WCF? Thanks
I have solved this by updating my VS2013 to Update 5 (maybe that didn't help solving the problem) and doing the following:
Right click on the service reference
Configure service reference
Uncheck 'Reuse types in referenced assemblies'

How can I remove an Application Pool in SharePoint 2013?

I use SharePoint 2013 and I create Secure Store Service App and remove it.
When I want create this Service Application with the same Pool Name I get this error :
This Server Application Pool already exist....
How can I remove an Application Pool in SharePoint 2013?
I found this post that also works for Share point 2013.
according to that, we can do this :
Launch the SharePoint 2010 Management Shell with administrator privileges
(Start -> All Programs -> Microsoft SharePoint 2010 Products -> Right click on SharePoint 2010 Management Shell -> Run as administrator).
Run 'Get-SPServiceApplicationPool'.
Run 'Get-SPServiceApplicationPool -Identity <"Name of the application pool">
Run ‘Remove-SPServiceApplicationPool’.
Input the Identity <"Name of the application pool">.
Input 'Y' to delete the application pool.

asmx service with silverlight VS2012

I'm trying to call an asmx service from a silverlight client but despite my best efforts I cannot get the generated proxy classes to be ObservableCollections, please help. I select ObservableCollection in the advanced configuration in the service reference, and I've tried updating the .svcmap file, but no success.
Any other ideas?
I don't have VS2012, but I am sure it should be same in VS2012 as of VS2010.
follow this steps
1) Add service reference (not web reference)
2) Go to Advanced Options
3) Choose Observale collection as option
4) You have your observale collection in proxy

ASP.NET Web Service returning Bad Request in Windows Azure

After a Windows 7 fresh restart, I open the Visual Studio 2010 as administrator, create a new project of Windows Azure Project with ASP.NET Web Role, then at the WebRole1 project I add a WebService1.asmx and press F5 (run).
The Windows Azure services starts OK and the browser open the http:/127.0.0.1:8080/WebService1.asmx perfectly. But when I click at Invoke button to test the webservice method I always receive a Bad Request - Invalid Hostname, with a http:/127.0.0.1:8081/WebService1.asmx/HelloWorld.
The most likely cause is ASMX's WSDL file doesn't stand by load balanced environment such as Windows Azure. The test feature relies on WSDL. You will see similar issues if you add a web/service reference. It is recommended to upgrade to WCF. In WCF, you can use useRequestHeadersForMetadataAddress (http://msdn.microsoft.com/en-us/library/ee816894.aspx) to fix the issue. If you need to use ASMX, please try to manually provide a correct WSDL file.

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

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. :)