Can I make an asynchronous call from one web service to another web service deployed on different server?
The scenario is that an ASP.NET webforms page will call a web service in an async manner. This particular web service will then make another async call to a second web service deployed on different web server.
This this possible to achieve, and what additional steps or code would be necessary to make this happen?
It shouldn't be any more difficult than just calling the initial web service in the first place. Website A has a reference to WebService B and makes a call to that service (in response to some kind of action on Website A). WebService B has a reference to WebService C and makes a call to that service (in response to the action being invoked by Website A). Website A shouldn't know/care anything about WebService C, and vice/versa.
Or do A and C actually need to know about each other in your scenario? If so, that changes things.
Related
I know that probably this question would be asked to many times but...
The wcf services hosted on iis7 in an asp. Net Web site can do things automatically? Like post a message to a pre-configured wall on Facebook given the permission to the application in a pre scheduled time?
For this to happen a client must send a request or it can do it alone?
The lifetime of a WCF service is typically determined by requests from a client i.e. if there is no client making requests then there is no service running.
Possible solutions:
Create a custom WCF ServiceHost, override the OnStart OnStop methods and create a background task.
Create an ASP.NET background task (external to WCF), which you can do with a library such as WebBackgrounder
Use the Windows Task Scheduler to trigger a task which polls your WCF service periodically which can then post outstanding messages to Facebook.
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)
I've implemented a new web service which uses SOAPExtensions for authentication. Everything works fine using a client that consumes this web service.
What I need to know is if there is a way to send any SOAPHeader parameters when invoking a web method from the ASMX Help page? I need this for testing purposes.
Take a look a this :
Stackoverflow Question
Why not just write a client application to test your service?
The client application can be a simple Console application, or it can be a unit test (even better).
I have a WCF service hosted at IIS7 web application. It's created by a WebServiceHostFactory. The client connects to a service calls the Collect method, and data are stored to DB. All working fine.
Now I would like to refresh page every time the new data are "collected" (i.e. the service method Collect is called).
My question is: What is the best approach ?
I was considering the CallbackContract, but this would require a singleton pattern (service is now PerCall), or is it a wrong assumption ? Is this approach possible ?
My logic is:
ASP.NET page subscribes to WCF service
the service singleton is created from now on
when method is called the services calls subscribers (clients)
there should be therefore only one service instance in order to subscription to work (or is it ?)
the client page refreshes itself
regards,
Kate
You can't refresh the page in a user's browser from the sever. Browsers use HTTP, which is a request-response protocol, so if the browser hasn't issued a request, it won't be looking for a response from your server.
If you have a Silverlight application hosted in a browser, that's a different story, but you didn't mention Silverlight anywhere. You would also be able to do what you're asking using WebSockets in HTML5, but that's not fully standardized yet.
I need to invalidate cache in a web application when related data is updated in another application (running on the same machine). Both applications use the same database. I know there's SqlCacheDependency.
How do is it in terms of performance?
Is interprocess communication (e.g. using name pipes) an option in web applications? Does it outperform SqlCacheDependency?
This is actually pretty simple to do by just using web services or a page action in each webapp. The web service can just clear a cached element whenever it is called.
When webapp A updates the data that is cached in webapp B, just have webapp A call the web service in webapp B that clears the cache and vice versa. You can add authentication as well if you want to secure it etc.
Anytime I have had to communicate with another web application and perform an action within the context of the other app I have done it by exposing web services or pages (ashx files) that will perform whatever action I need.
You could use a distributed cache instead, e.g. Velocity http://msdn.microsoft.com/en-us/magazine/dd861287.aspx