Is there any existing way to consume web services (SOAP, JSON, etc.) leveraging dynamic keyword from C# 4.0?
I'm looking for as lightweight implementation as possible (without calling wsdl.exe or such).
You can just share the contract (the interface) between the client and server. Then the ChannelFactory class will allow you to create communication channels to the server based on either pure code or a configuration file (app or web.config).
Related
I have a web service that have functions to retrieve data from database. (http://exampledomain.com/webservice/webservice.asmx) It's easy to add a web service in C# (Project->Add Service Reference->Advanced->Add Web Reference) but i don't have any knowledge about C++. Also there is no option in Project tab for adding reference. How can i add web service to C++ project and access it's functions and retrieve data?
Standard C++ or MFC do no provide a way to consume web services. However, it is possible to do so with C++ REST SDK. It's a cross-platform library that allows you to consume services, use json, asynchronous streams and other things.
I have several unmanaged c++ programs that I use to do "heavy lifting" type operations. I like to database certain information that these clients use. In order to do this I created a WCF service which exposes my DAL to the database. I then created a managed C++/CLI wrapper to call the web service from the native C++. Would it be better to parse the WSDL using gSOAP and connect to the WCF service using SOAP?
The C++/CLI wrapper approach does have many advantages. This does make a simple way to use all of the WCF tooling, with any transport mechanism, from within C++. However, it does introduce a dependency on the CLR, which may or may not be acceptable.
Another option would be to use the C++ REST API (aka Casablanca) to call the WCF service directly, using a pure native API. This would require exposing the WCF service via REST.
I am developing an appplication that consume data from WCF Web Service, but the data need to be retrieve from differents servers applications provided by different suppliers.
The question is what programming language support the develop of a Web Services from a WSDL that already exist?
For example in .NET you could use "wsdl.exe /serverInterface" to generate a server interface. See Implementing Service Interface
In Java see: Top Down Java Bean Web Service
But I don't want the suppliers to be attached to an explicit tecnology.
... I don't want the suppliers to be attached to an explicit tecnology.
You are taking about web services. The idea with web services is that it allows interactions between heterogeneous machines (and technologies).
For the interaction to happen, there is no need for the machine to use the same programming language or technology. What's important is the protocol used. In your case SOAP.
The protocol defines the communication interface or contract. For web services, the interface is described by the Web Services Description Language (your WSDL).
WSDL is in a (more or less) human readable format, but more importantly in a machine-processable format. The idea is that you use the WSDL to generate the code/classes that respect the contract; at the server side they are called Skeletons, and at the client side, Stubs.
A lot of programming languages have means or tools to generate stubs/skeletons from WSDL but again, that's not the important part. The important part is respecting the contract.
The WSDL just allows you to automate the creation of some boilerplate code. It's not mandatory to use the WSDL to create the server/client so any technology can be used (with or without the WSDL).
As long as you do that, you do not attach yourself to an explicit technology. So in the "WCF Web Service" you mention, you can drop the "WCF" word.
The only care you must take is with the interface between the systems. You must ensure the Web Services Interoperability as we don't live in an ideal world and some specifics from the technology stack "could leak" in the contract if you are not careful.
The Window desktop application provides C++ API that gives an array of customer information such as name and address. I want to expose this as SOAP Web Service with Security so that authorized clients (from remote servers Linux/Java based through ESB) of this web service can get this information at any time they want in SOA implementation (Java based).
The desktop application does not have a standard database. It stores its data internally. Its basically old custom built CRM application that is installed on each agent's PC box. Each agent has its own list of customers.
What are the steps to achieve this task?
Do I need to run this as Windows service?
The short answer is, yes, you can expose data from a desktop application through a SOAP web service. It is easier to do with C# and .NET, but not impossible to do from C++. What steps you need to take will depend on which platform you are developing for.
Roughly -
Implement an endpoint that supports SSL where clients can connect to your desktop application (using sockets in C++ or HTTPListener using .NET).
Write code that can receive and dispatch SOAP requests.
Handle SOAP requests and return properly formatted SOAP responses.
Handle WSDL requests.
Implement a security mechanism (cookie based or otherwise).
Using .NET, most of this is in the platform code already, you just have to put the pieces together. With C++, you may find some third party libraries but essentially you'll be writing your own.
You only need to implement a windows service if you want the data to be available while a desktop user is not logged in and running your desktop application. The challenge here is that you'll have to make sure the windows service can access the same data the desktop application is using.
Another strategy would be to access the data from your desktop application using the C++ API and Interop and implement the web service as a standard out of the box asmx hosted on IIS.
I have a set of embedded devices that run software written in c++. The API to communicate the devices is simple: get/set/acquire parameters and signals.
I'd like to implement common web application to access all of the devices from a single point.
My idea was to add XML RPC interface to devices and then use ActiveResource to access devices from the web server. This combination doesn't seem to be used at all in practice.
I'm free to choose any protocol inside the devices. What are your recommendations?
If you're already considering XML RPC I'm assuming you have some sort of web server running on the device. I would probably choose a RESTful web service over XML RPC. If designed carefully you could have corresponding services on your Rails app.
For example:
http://somedevice/signals.json - gets all signals
http://yourrailsapp/somedevice/signals.json - gets somedevice's signals; you could use an id instead here if that makes more sense (http://yourrailsapp/devices/1/signals.json).
You probably won't find much XML RPC stuff in the Rails community. Rails itself really pushes you towards RESTful web services. Specifically a resource-oriented RESTful architecture. There are great books out there about it but it comes down to using http methods (get, put, post, delete) instead of passing parameters and then some intelligent URLS.