How to set SOAP protocol for a ASP.NET web service? - asp.net

I m newbie to ASP.NET web services.
I have written my web service, web method. I want the output of my web service to be in SOAP rather than the default HTTP POST protocol.
How do i do that?
I need the output to be SOAP as i need to deserialize the xml file, in my web application where i will be consuming the web service.
Please help.

Follow these steps
1.In the Web Service Details window, select an operation for that Web service.
2.On the Diagram menu, choose Properties.
3.In the Properties window, set the appropriate SOAP properties under the Implementation heading.
http://msdn.microsoft.com/en-us/magazine/cc164007.aspx

Related

ASP.NET app communicates with another app via xml messages?

I am fairly new to web applications. Could someone explain how I can make an asp.net web app that needs to communicate to another application that only understand XML messages and receives messages via TCP/IP protocol? Do I need to create ASP.NET RestFul API to achieve this.

What is left of an ASP.NET MVC application when consuming an ASP.NET Web API?

As a learning exercise i want to create a simple web api and consume it using a web client(asp.net mvc) and a desktop client(winform).
The web api must handle categories, products and of course users/roles as follows:
everybody can browse categories and products
regular users can insert/update/remove products
administrators can insert/update/remove categories and products
Regarding first consumer, the asp.net mvc application, i have the following questions:
In controllers, will be anything else than ViewResults, because from what i understood all http requests are made from javascript?
What about authentication and authorization?Since we are talking about a RESTFUL service, there is no connection between calls and the user must send in every request some piece of data to identify himself.
2.1 Is there any point in using HTTPVerbs ( in ASP.NET MVC apllication) ?
2.2 What about FormsAuthentication?
2.3 How do i safely send the credentials to the web.api?
Everything is so blurry for me, is there any example with some web api, hosted in the iis independently and consumed by an website (ASP.NET WebForms or ASP.NET MVC) because all examples i have seen weren't that clear.
1) In controllers, will be anything else than ViewResults, because from
what i understood all HTTP requests are made from JavaScript?
Not necessarily. You could perfectly fine use the HttpClient (the Web API Client classes) to consume your RESTful actions directly from your standard ASP.NET MVC actions. For example you could perfectly fine have a repository which uses the HttpClient to consume an ASP.NET MVC Web API method to fetch the data instead of querying a relational database. You should not necessarily expose your WEB API methods to client side JavaScript. They could serve as a gateway to your data access. There are many possible scenarios of course.
2) What about authentication?Since we are talking about a RESTFUL
service, there is no connection between calls and the user must send
in every request some piece of data to identify himself.
There are many ways to perform authentication. One of them is to use Forms Authentication which is a well established mechanism involving cookies. So the piece of data that will be sent from the client to identify himself is actually a cookie in this case.
2.1) Is there any point in using HTTPVerbs?
Of course. REST is all about HTTP verbs. In the case of ASP.NET Web API it is the HTTP verb that determines which API controller action to invoke by convention. You could of course violate this convention by overriding the default routes setup.
2.2) What about FormsAuthentication?
See point 2)

How to call XML Webservices in ASP.Net

I am trying to call web services in my asp.net application.
I got success in calling normal web service.
But Now I am trying to call xml web services in my web project.
I have try for this using xmlhttp but i didn't get success in this.
Can anyone help me in this?
It's not clear what you mean by XML web service. For example ASP.NET web services that use SOAP are also XML. Maybe you mean a POX service (Plain Old XML)? In this case you could use a WebClient or an HttpWebRequest to manually forge and send an HTTP request to a given resource and fetch the result.

Can I create a wsdl from a c# WCF service the same as I used to do with c# web service?

I have to write a web service and I want to use WCF. The developer im working with wants me to provide a wsdl. What im wondering is will I be able to use the WCF service we have in place and use a credential header like I used to with web services?
Yes you can.
You need to add a mex endpoint (meta data exchange) and allow http get for metadata exchange.
All of these are on by default.
You just browse your service and click on the wsdl link.

session sharing between silverlight and asp.net

I have a silverlight application that uses wcf service. This application is shown from a link in an existing project of asp.net web application type. There is a userid session found in the project that i want to transfer it to the silverlight application. I thought of query string but its not a secure thing to do it. so is there a way to transfer the asp session object to the wcf application which the silverlight application communicate with?
You could write a web service that you could use in Silverlight and with which you could get and set single values from and to the current session.
If you want to transfer the whole session to Silverlight, this is of course also possible by a query parameter or the like.
Concerning security, it depends on your scenario. There is no way around that, you do have to send the data over the wire to the client in some way. You can encrypt it, but the Silverlight client will have to know how to decrypt it. Silverlight client code can of course always be inspected in reflector by anyone who has access to the application.
What you can do is set everything up to use SSL for communication, it might be sufficient for your scenario if you never send more information to a client than a client is allowed to know.
If you can run WCF services in ASP.Net compatibility mode then you would be able to share all of the ASP.Net Runtime Objects such as Session, Cache etc.

Resources