I have an existing web service built using C#. It implements a standardized interface which I cannot change. I would like to add a second interface to the web service but I am unclear on the coding mechanics. For the first interface and have written a class to implement the functions.
Question 1: For the second interface, do I create a new class to implement its functions, or add them to the class defined for the first Interface?
Question 2: What modifications are needed the the configuration file of the service's host program so that it recognizes the new interface?
If you need them in the same web service, then you could write an interface which extends the compulsory, standardised interface, and then expose that through the web service. It can be consumed by a client expecting either your interface or the simpler one. On the service side, just configure this as implementing your new interface, and you should not break connectivity for a client expecting just the simpler one.
Related
This is with respect to a JAXWS webservice. In a library (jar), besides many other classes, I have all the classes generated by wsimport, and the implementation class.
Two separate (EAR) applications depend on this library for different reasons.
In one application, I would like the webservice to be not started (not available), in the other application I would like the webservice to be up and running.
I did not write any Java code explicitly to start the webservice. I think, since the implementation class has #WebService annotation, and so, the environment automatically makes the webservice available.
If instead there is a way to manually start (publish) the webservice, and not use the automatic means, then we can do the manual publishing/starting in one of the application where it is desired.
Any ideas?
In my mind a webservice is a service that create a link between some applications. What I want to do is calling a c++ program installed on a server into a webservice.
However I have found how to call a webservice in a c++ program but that's not what I am looking for.
How do you call a c++ code into a webservice ( I am using VS2013 btw) and is it relevant to do that.
So my question is : How do you call a c++ code into a webservice ( I am using VS2013 btw) and is it relevant to do that.
A web service is a service accessible remotely, which publishes several "endpoints".
Each endpoint corresponds to a function call (possibly implemented in C++).
To call a webservice endpoint, you must serialize the input parameters of the endpoint in a format accepted by the web service (in practice, this usually means generating a SOAP/XML document that contains the values of the parameters), then sending the serialized document to the server. The server then de-serializes the parameters, calls the function, serializes the result, and sends it as a response.
Webservices publish their endpoints (their accessible/callable APIs) in another XML standard, called WSDL, and public web services are usually listed in a public directory.
For this you will need a networking library usable in C++ (see gSoap), or an implementation of your own, on top of a networking library (see boost::asio).
It depends on in which language your web service is coded.
If it is PHP, see the function system to run another programme that you can code in any language you want (including C++ then).
If it is C/C++ on Linux, see the functions fork/exec's to create a new process and run another programme in that new process.
If it is C#, see this tutorial on Process.Start.
If it is Python, see the subprocess package from the standard library.
Anyway, if your web service is in C++ and that the code you want to execute is in the same programme, you can just do a function call in your web service's method.
I am trying to consume an existing web-service from another company and have troubles to find a solution to use the same web-service from different location.
An existing web-service is available at the address http://url.to.A/webservice/ and I am able to generate a C++ proxy class for this service using sproxy.exe from the ATL tools.
Using that class, I can consume the web-service without any problem.
Now I need to consume the same web-service but from another URL (let's say http://url.to.B/webservice/) and the previously created proxy class is not working. The SendRequest method inside one of method proxy always returns an erroneous HRESULT code. Generating a new proxy specifically for this second service gives a working solution BTW.
When I say that the services are the same I mean that they expose exactly the same methods so that their respective wsdl definition files differ only by the service URL.
I've tried to change the URL property of the generated proxy class instance but it doesn't help.
Given that I am tied to use unmanaged C++ for the consuming part and that I would like to be able to specify the service endpoint at runtime, is there a viable solution to my problem?
Thanks for your help.
Generate a separate proxy class for each server/service.
Then do a diff on the generated code. That should let you know what the differences are.
It finally turned out that it's not possible, using sproxy.exe, to generate a class that can be dynamically assigned to a webservice endpoint.
I have got a web application which is speparated in a GUI (JSF 2.0, Orchestra, Spring) and service (Spring, JPA, Hibernate,...) project. Due to network issues between the web server and the database server, I neet to split the application completely, between the layers and deploy them on two different tomcats, for the service part close to the database server. I have generated allready a webservice and a webservice-client with the Eclipse WTP CXF Plugin.
My Problem is: For the client it generates a copy of the domain model classes, so I can't use them directly in my gui project and would need to introduce an conversion layer, between the web service client and the gui layer. Wich is cumbersome and error prone.
Is there a possibility to generate the web service client (out of the existing web service module and the wsdl) using the shared domain model (model classes are in an separate project, wich both - service and gui - projects depend on)?
desperatly looking for a solution, as the deployment deadline is close...
To generate a copy of the domain model classes (DTOs) is a good practice when you have two physical layers : Your Hibernate POJOs need to be deproxyfied before being sent to an other physical layer. Maybe you could use Dozer to do it, to avoid to spend too much time doing it.
Maybe you should use RMI instead of Web Services if you need performances.
If you're absolutely determined to use your domain objects in the presentation layer, you should look about Gilead (formerly known as Hibernate4GWT).
Pure DTOs, DTOs with Dozer, and Gilead use are described in details here :
http://code.google.com/intl/fr/webtoolkit/articles/using_gwt_with_hibernate.html
I apologize if if this is a bonehead question.
I've used WSDL to generate code to talk to web services, but my question is about using it to actually generate web services.
Let's say that I have a device that is going to communicate with a web service. The web service in question doesn't actually exist and is out of my control. That is, the party wishing to process messages from my device must implement the service.
The service in this case is extremely basic. It's simply a small collection of methods that receive messages and return status codes. It's basically a middleman between my device and 3rd party software.
It would be really cool if I could supply something like a WSDL 2.0 document that they could then use to actually generate the boilerplate code for the service and methods they are required to implement...preferably in Java (Axis) and .NET friendly frameworks.
In other words, I want to use WSDL to generate the service, not the client. Or maybe I don't want WSDL at all. What techniques would you recommend to make this as painless as possible?
SvcUtil.exe for the Windows Communication Foundation technology in .NET 3.0+ can do some of what you're asking, i.e. generation of contract interfaces and basic client code using a predetermined WSDL as input.
Now, this will not fully generate the actual service, just the contract interface. I don't know of an easy way to do this as it is probably not a very common case. Essentially what you're asking is a slightly more automated version of what Visual Studio does when you create a class and use the "Implement interface" feature (which I believe is accomplished mostly through VS templates).