ASP.NET MVC 3 and WSE 2.0 - asp.net-mvc-3

I've an ASP.NET MVC 3 project and have been tasked with implementing a few UI controls. I need to call a few web services and bind the data to the UI controls. The problem is the web services host (we have no control over them) requires me to first implement a UsernameToken class (WSE 2.0) to authenticate the user and generate a security token. I understand WSE 2.0 is superceded by WCF in 2006. I don't want to switch back to VS 2005 to be able to use WSE 2.0. What are my options?
Thanks for any help!

Just add a Service Reference to your ASP.NET MVC application and point it to the web service WSDL. This will generate a strongly typed WCF client which is compatible with WSE. Here's an article which covers the different interoperability scenarios

I'm afraid the approach Darin Dimitrov didn't work. What I have ultimately done is installed WSE 2.0, then added dll reference to Microsoft.Web.Services2.dll found in the WSE installtion directory (c:\Program Files (x86)\Microsoft WSE\v2.0\Microsoft.Web.Services2.dll). I also modified the Reference.cs file of the service to inherit from Microsoft.Web.Services2.WebServicesClientProtocol. I was able to find the UsernameToken class and able to authenticate successfully.
I'm not an expert in this area so I'm not sure if this is the correct way of doing this, but it worked nonetheless.

Related

Service Layer with WebApi

I am starting to work on a new project so working on laying on the architechture at this moment.
So basically we want to keep a service oriented architecture using MVC web api.
So I had the following structure in mind:
Project.Core (All Poco classes)
Proect.Data (All entity framerwork)
Project.Service (All Web API ??)
Project.Web
We would be working for the first time on webapi here. So wanted to know how do we intergrate webapi here.
Most of the articles we saw read had created a mvc web application and had selected webapi in that. But we
were looking to create separate service layer just for webapi. Is this the correct practice to do that or
I am missing something here.
We basically wanted not to have a tight coupling b.w MVC web and web api here. If we create web api as part
of mvc then how can we separately access our web api.
WOuld appreciate inputs.
I normally use the project template provided by Visual Studio. Choose Empty ASP.NET project template and then select Add folders and references for Web API. It will create the folder structure needed/recommended purely for a Web API project without any MVC reference. I generally create a separate project for Data Access and use that from the Web API project.

How to Replace Web Service Binding - Tuscany SCA with Spring from scratch

I have had some experience of developing web services (standalone) which are called via angularjs single page apps. But, I now have a Java EE task which involves the following:
1. Removing a Tuscany SCA web service binding from some business components e.g. Customer, Accounts. The components are exposed as web services
2. Replacing the Tuscany Binding with a Spring Injection web service binding.
NOTE: The decision to replace Tuscany SCA with Spring is already made.
But, as a developer with experience of developing web service without any knowledge of the binding frameworks. I need some understanding of what these frameworks are, how I can wire this framework to my web service from scratch.
I don't just want to copy and paste and do try and error on a commercial project.
I am afraid, there was no KT, hence I am learning this the hard way!
Please, can someone help me in understanding this underlying framework or binding.
What are this binding or binding frameworks?
Why do we need them?
How is Tuscany SCA different from Spring?
Any help good, practical, code sample, online references etc will be appreciated.
Thanks.
You are not clear with concept of SOA, SCA and Tuscany.
First understand which type of webservice is written in your project whether RESTFul or SOAP. And then understand how SCA + Tuscany service is written for for RESTFul/SOAP service and then try to remove Tuscany from it.
Reference docs:
http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html
http://www.springsource.org/spring-integration

quickest way to implement .net authentication in Web Forms with Entity Framework 6

I have been checking resources to implement authentication in my web forms application built with entity framework. All examples I found are MVC-related. I have used regular Asp.Net Membership framework a long time before I began to use EF. However, I could not find Membership implementation with Entity Framework code-first. I did implement the Claims-Based Identity (EF created the tables for me in DB) but I do not know how to utilize it in the application (like login), and it looks more complicated to me. Can anyone guide me ?
There are a couple of good tutorials on the asp.net web site:
http://www.asp.net/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project
http://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/membership-and-administration

Best way to consume WCF Service inside ASP MVC3 app

I am new to the world of WCF and MVC. Currently I have a MVC3 ASP application and a WCF service app exposing some services. I want access this service from MVC3 ASP app. As I know either this can be done by adding the Service Reference to ASP project or by generating proxy class from WCF service and add proxy class to ASP app.
My question: Is it the right way I am going (as said above). If so which method is better (adding service reference or generating proxy class and adding it manually)?
It is a lot easier to use add service reference. Add service reference basically means that you are asking visual studio to do the job that you would have done if you were generating it manually with default settings.
If you don't have any reason not to go the easier way, then my advice is to use add service reference.

WCF or Asp.Net MVC for API acess?

I wanted to get some thoughts about API access either through WCF or MVC. Either works, but I like the idea of using MVC to build custom routes. I know this is possible with WCF (maintaining the request routes), but aside form the security disadvantages of not using WCF (which are not deal breakers) what other thoughts does the community have regarding this.
I have a project where we have been discussion using MVC or WCF and we are comfortable with both, but we are swaying towards MVC.
You should use the new ASP.Net MVC Web API framework, new to MVC 4.0.
I think MVC makes a great web API. I did this not too long ago for an android app that uses a RESTful web API using MVC 3. Here's a good tutorial:
http://msdn.microsoft.com/en-us/magazine/dd943053.aspx
If you're feeling adventurous check out the Web API framework included in MVC 4. NOTE: I have not experimented with this yet but plan to in the near future. See here: http://www.asp.net/web-api

Resources