Weather Forecast Web Service - asp.net

I want to understand more how to get third party web services working, after looking through tutorials I have managed to get a QuoteOfTheDay(); web service working. But I do not know where to start with this one:
http://www.restfulwebservices.net/wcf/WeatherForecastService.svc?wsdl
Any tips in the right direction would be great.
Thanks.

You have to add Service Reference (right click on you project in Solution Explorer and select Add service reference). In url field input "http://www.restfulwebservices.net/wcf/WeatherForecastService.svc" and click OK. Master will generate a proxy class to this WCF service.
Then you can use this WCF service as any other web service.
As you can see in wsdl, this service provide two methods - GetCitiesByCountry and GetForecastByCity. I think it is obvious what they do.
I don't see any documentation for this WCF service. I only found small sample for Java. It invokes GetCitiesByCountry method:
http://doc.nuxeo.com/display/NXDOC/Building+a+SOAP-based+WebService+client+in+Nuxeo

Related

PLONE to call and perform REST API calls on another application

we are developing a plone interface to consume REST API services from a web application.
Users login to plone and be able to access the REST API & perform some actions on the "Another Web Application" via REST API calls. Please find the graphical representation attached here.
Query 1)What and all the Plone programming documentation I needed to refer to design & develop such a solution in Plone? that is,access and perform actions on REST APIs, from a PLONE based Solution.
Query: 2) What all are the different technologies I need to refer to learn & program in PLONE and python to achieve this work using PLONE framework?
Please share your valuable inputs and suggestion to move in the right direction.
Please refer the attached block diagram of the proposed solution.
.
In a first step you could register a "view" for authenticated users in Plone. In the view's Python module you could call the restful api of the other web application.
Helpful resources are:
Creating a basic package (Plone Addon) with mr.bob and bobtemplates.plone: https://github.com/plone/bobtemplates.plone
Creating and registering a view: http://docs.plone.org/develop/plone/views/browserviews.html#creating-and-registering-a-view
Call a resful api with python: Making a request to a RESTful API using python
If you have to collect data from your plone site to transmit to the restful api f.e. user data, then plone.api is the standarized way. http://docs.plone.org/develop/plone.api/docs/
Recently a very nice module developed, exactly for the purpose you mentioned here, in Plone. It's called "plone.restapi".
github link: https://github.com/plone/plone.restapi

Using webservices with in .Net project from local namespace is valid approach or not?

I am newbie in webservices of .net, i am implementing a project of .net with backend in webservices as i got impressed with the benefits and portability of this architecture.
But the confusion is, i want to know the way i am adopting is right or wrong. I have made services with in my project and calling them from code behind classes, where as my service is implementing the database code. I am attaching the screenshot for further explanation.
Not really, when you do this you are calling the classes directly rather than as a service call. This is liable to cause you issues (e.g. if you set up one of your methods to return a certain HTTP response status for example).
If you don't want this to be a service call, then you would be better extracting the logic from the service method into a business layer and have both the service and your page call that code.
If you do want a service call, then you need to add a service ref to your project that points to the service and call it through the generated proxy.
Your approach makes no difference of using a C# class vs using a webservice.For this approach You can use a class instead of a webservice.
Use web services instead of C# classes for the following cases.
You want to expose some functionality to outside world/consumers/other applications
You want to decouple parts of your system so that they can be changed without affecting other parts of application
You want to do make your application scaleable, so you create webserices and deploy those on different servers

Why do I need to set up the aspNetCompatibilityEnabled twice?

Could anyone please explain why when creating a WCF webservice in which you want to use HttpContext.Current.Items you need to add some code in 2 places?
One in the webservice itself ([AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]) and one in the web.config file (<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />)?
A colleague of mine just had all his webservice calls failing. He had the web.config setup missing and asked me why. I tried to explain, but I'm not sure if I was able to :)
I think it has to do with the separation of the webservice code and the place where the webservice gets hosted. The webservice itself says that it needs that compatibility mode. It is then also needed to setup the hosting environment to say that it should run in that compatibility mode.
Isn't this basically the point?
He still had a question: "but, if the service uses that attribute, should it not be automaticly ?"
The first tells WCF that aspcompat must be enabled and the second enables it. You should be able to do without the first.
This forces the person configuring the WCF service to use the right config.
MS designed this with the idea that the person configuring the service might be someone else that the person that made it.
To answer his last question. When you add attributes to your service you're not configuring the host, you're demanding how the host should be configured. The configuring happens on the host.

REST web service with asp.net

How can I add a reference to the REST web service to an ASP.NET application? The REST is generating the WADL file. How can I add a reference to my application . I tried the regular way, using Add Web Reference option, but that gives me an error.
You already asked this question a few days ago. You cannot do it, nor should you try to do it. One of the major objectives of REST is to decouple the client from the server, if you start generating proxy code on the client based on WADL you are likely to embed information into the client that with create coupling.
A REST message is supposed to be self descriptive therefore WADL should be completely unnecessary for a correctly built REST service.

Viewing event log via a web interface

I'd like to be able to view the event log for a series of asp.net websites running on IIS. Can I do this externally, for example, through a web interface?
No, but there are two solutions I would recommend:
Adiscon EventLogger is a third-party product that will send your Windows EventLog to a SQL database. You can either send all events or create filters. Of course, once the events are in a SQL database, you can use any of the usual tools to create a web interface.
You can use ASP.NET's HealthMonitoring configuration section to configure .NET to send all ASP.NET-related events directly to a SQL database. This covers exceptions, heartbeats, and a host of other event types. The SqlWebEventProvider is a cinch to setup.
Do you want to know if you can home-roll something or are you looking for an app you can get off the shelf?
I'm not a Windows guy, but I think Microsoft's MOM/SCOM solution will probably let you view the event log over a web UI - probably really heavy and expensive if that's all you need though.
A quick google found http://www.codeproject.com/KB/XML/Event_Logger.aspx which shows that you can get in if you want to roll your own... also an MS tool on msdn
Sorry I can't be more help

Resources