Here's my situation: I'm writing a SOAP client using WCF. I am going to invite 3rd parties to develop services that my client can consume. This is kind of backwards from the norm, I think. As the client develper, I'm creating the specification, and the server developers are following it.
When it's the other way around, and the server developer is using C#/.NET, the process would go something like:
1) Service developer creates C# interface, a service type that implements it, and a host to serve it.
2) Service developer uses its server to generate WSDL and provides it to client developer.
3) Client developer uses WSDL document to generate a proxy and uses the proxy to consume the service.
However, I'm completely at a loss as to how to do this in reverse. So far, the only thing I've been able to thing of is to do step 1 as a mock, generate the WSDL for my mock, and provide it to the service developer. I'd prefer not to have to go through the work of doing this. Plus, I'm not sure how feasible it is for the service developer to generate a service based on a a WSDL document, especially since the service developers would probably not be using .NET. They could be using any number of SOAP frameworks and languages. I'm afraid that their service implementations would end up differing enough that my client application wouldn't be compatible with all of them at the same time.
I want this to be as easy as possible for the service developers, to encourage them to write them, but I want to have a single client, without having to modify my client code for each server.
I'm not really familiar with SOAP frameworks, other than WCF, so I don't really know how much is the same/different from WCF implementation.
Ideally, I'd like to just provide them with the C# interfaces, or run them through some tool that would generate information that they can use to implement their services in their language/framework of choice, and perfectly implement my specification.
What would be the best way to accomplish this?
Related
I have N quantity of "clients", and each one has to implement a web service for my .Net app to consume. I dont want to add a service reference for each client because they can change at any moment, as well as the URLs, so I store the URLs on a database and dinamycally create the endpoint depending on which client I want to access.
I was wondering if I have to force my clients to write the same type of services(either WCF or JAX-WS) or I can still connect to one or another without writing some kind of conditional logic.
ie. If JAX-WS then "do this" ELSE IF WCF "do other stuff"
Also I was wondering if adding WS-*(wshttpbinding) security would add more complexity for the interoperability(or interchangeability) of the two technologies.
Any comments about this approach would be greatly appreciated.
It's possible to implement this without having to use an if-else , all clients/implementations (.NET and Java) must to use the same contract (WSDL) which should not be a big issue.
For the WS-* this is quite easy using only .NET BUT it's hard (not impossible) to get it working from .NET to Java so I usually end up doing basicHttp using SSL with either basicauthentication (username/password) or certificates. This is a lot easier than wsHttpBinding from .NET to Java.
Like Cheeso says, start with the WSDL, i.e. create a client and service in .NET, this will give you a WSDL, then take that WSDL and use it to implement the Java clients.
Start with WSDL first. If you don't know what this means, google it.
This does not guarantee interoperability but it gets you a long way on the path.
As for adding WS-*, yes, that introduces an additional level of interop challenge.
Can I write a web service that implements the same methods and returns the same custom objects using both C#/WCF and also Java Web Services? And if so, can I then access the web services using a single web reference but with different addresses?
I'm asking because I have to host a web service that has a GetCitations and GetTerms method for publically exposing our database content. We are on IIS, so I was going to do it with WCF. However, other partners in the project also have to host an equivalent service and they are all Java based.
We are then building a software app that needs to connect to any number of these services (as defined at runtime by a user). I am expecting that we can have one set of classes to connect to these services (but with different endpoitn addresses), but am not sure whether I'm right in expecting this to work.
Is this possible?
And what considerations/restrictions are there?
Thanks.
It shouldn't be a problem, if you make sure that both services have equivalent wsdl files and you use http/soap binding.
I am not sure about using the binary (net.tcp) one with WCF, though. It might be a problem.
One way to do it is to use JAX-WS (Java 6) to expose a method as a web service.
The JAX-WS stack allows for automatically generating the correct WSDL at runtime.
The .NET team can then take that WSDL, and use standard tools to create a mock implementation of that WSDL. This mock implementation is then used as the actual .NET implementation, and you then use standard tools to generate the WSDL for that web service.
You now have to web services with the same semantics each with their own WSDL.
Both Java and .NET can implement a SOAP compliant web service, so the answer is yes, you can write a .NET and a Java webservice that implement the same WSDL.
I am new to server-client applications.
I am trying to build a prototype where a Java server communicates with a .net WPF client over http. The server and client currently communicate over a third-party messaging system(Tibco). I have done a bit of research and have decided on using SOAP and WCF. I have been trying to find tutorials on how to implement this but cant seem to find anything that fits my need. If anyone could point me to some resource that a newbie like me could use to come up to speed with implementing SOAP and WCF to existing system I'd really appreciate it. Also if anyone has any suggestion on any other protocol that could be used, feel free to recommend it.
We did this at work to support some 3rd party interop scenarios and our process looked like:
Generate a WSDL for our WCF service via the wsdl.exe tool (we defined a basic HTTP version of our services because of the lack of eventing in Java),
Used an apache CXF tool, wsdl2java, to generate Java classes for the WSDL,
Used the autogen'd client definition as a wrapper to perform calls on the server.
I'd imagine in your case you'd do the exact opposite, using java2ws.exe in the Apache CXF framework to create your WSDL, then using wsdl.exe in the .Net framework to generate your c# classes (or other CLI classes...), then consuming those classes to accomplish whatever it is you have a client do.
Here's the API page for the CXF Java->WSDL tool - http://cxf.apache.org/docs/java-to-ws.html
And for the WSDL.exe .Net tool - http://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.71).aspx
My understanding is that a c# based client "prefers" SOAP because when you add a web service reference it creates a proxy class from the wsdl found at the url you specify.
Which almost makes it transparent to the c# client that we are even using a web service, it almost feels like we are using a local class library. you call methods and you use objects.
My question is can REST achieve the same affect. I assume that it can't since it doesn't have wsdl and thus visual studio can't generate a proxy class for it. But Please correct me if I'm wrong?
A "run of the mill" REST service cannot achieve the same kind of tight integration with C# - mostly because it lacks the metadata that a SOAP service will provide (with a list of methods and their parameters and all that stuff).
The WCF Data Services (built on top of REST) do work much the same way as SOAP services, since the OData protocol contains extensions for pure REST services that provide metadata information needed to create a good, useful client-side proxy.
REST can be used to generate client side class libraries. For Example You can create proxy classes for MS generated REST services. In fact MS is actively pushing this model for Entity Framework based WCF DATA Services, e.g. those used by Silverlight and RIA applications. check out MS ODATA framework for REST which involves creating client objects out of standard REST queries.
http://msdn.microsoft.com/en-us/library/dd673930.aspx
Ok, all these methods of getting data in a Silverlight control are confusing me.
I've looked at ADO.Net Data Services, Web Service and Silverlight-enabled WCF services.
I'm just not sure when one is appropriate to use over another. What pros/cons do each offer?
I've built a web app, and a Silverlight control. I will be adding one of those 3 options to my web application and consuming it from my Silverlight component.
From the silverlight perspective, WCF is heavily constrained anyway, so most of the usual benefits of WCF don't apply. However, it is still a fairly nice, consistent programming model.
WCF is primarily a SOAP stack, so it is very good at presenting data as rigid operations. ADO.NET Data Services is a REST stack, and allows very expressive queries to be performed dynamically over the wire.
I don't know how it is in Silverlight, but a regular ADO.NET Data Services proxy (the bit on your client app) has very rich support for both query and data changes back to the server. Note that applying changes requires either a: Entity Framework, or b: lots of work. But you should get query and update very cheaply with this approach.
With WCF, you get a much more controlled stack, so you will need to code all the distinct operations you want to be able to do. But this also means you have a known attack surface etc; it is much harder to exploit a locked down API like a fixed SOAP endpoint.
Re regular web-services (pre-WCF): only go down that route if you want to support very specific legacy callers.
I know this is old, but I just wanted to add my 2 cents.
I would highly recommend using WCF; and use the WCF Service Library project over the Silverlight-enabled web service. They are both essentially the same, but the Silverlight-enabled web service changes the binding to basic instead of ws*. It also adds an asp.net compatibility mode attribute.
WCF is usually faster: See "A Performance Comparison of Windows Communication Foundation (WCF) with Existing Distributed Communication Technologies" # http://msdn.microsoft.com/en-us/library/bb310550.aspx
WCF encapsulates asmx, wse, msmq, enterprise services, and remoting.
WCF services can be included and run within iis, windows forms, etc.
WCF isn't restricted to using HTTP, but with minimal configuration can also use tcp, named pipes etc.
complex data types are easier to expose and serialize.
WCF just scales really well. Plus, they can be used to incorporate workflows from WF.
There's probably not a wrong technology to use, but it seems as if Microsoft is going to be moving forward with WCF. Plus, it's just so much easier to write one code base that can be exposed so many different ways with just a few configuration changes to the WCF service.
I recommend not using the Silverlight-enabled web service, just because the programming structure is set up a little better with the WCF model, but this is probably a matter of opinion.
If you have to choose between a web service and a WCF service, my advice is to go with WCF. It's more modern and more powerful technology. As for ADO.Net Data Services - you can use that if all you need is to retrieve/commit some data from/to a database back on the server.