Given a public SOAP web service and no WSDL, I need to build a .NET client that can communicate with this service.
I'm a .NET dev looking for a simple way to generate a WSDL file given this url? I'd prefer to do this with some tool directly from my windows development machine but the only thing I've found is the javatowsdl tool in Apache CXF or Axis2. Are there any tools (commercial or otherwise) that would accomplish this? I'm really hoping not to write my own WSDL by hand.
If I have to go the route of the javatowsdl, can this tool be used without having to setup a server to run apache/tomcat, etc? anyone know the steps necessary to actually make this work?
Update: This KB describes generating a proxy via wsdl.exe or VS both of which I've done before. The interesting part of this KB is the part at the top where it mentions using the WSTK from IBM to GET the WSDL in the first place. The WSTK no longer exists and I'm looking for alternatives. http://support.microsoft.com/kb/307324 Hope that helps to clarify things a little.
I didn't see this mentioned, but have you tried appending '?wsdl' to the end of the soap url and trying it out in a browser?
Say for example the url to the service is http://www.someserver.com/service/NewService. Then you could try this in any web browser and see if it works
http://www.someserver.com/service/NewService?wsdl
If the browser pulls up the wsdl, than you can also the same url to wsdl.exe and it will generate the .NET client stubs for you.
Supposing you are using Visual Studio, right click your project and click Add Web Reference. Then enter the end point URL and you should do fine from here. Further details here.
Not sure what you actually want to create the WSDL from...? You say this is about a public SOAP service without WSDL - which means that this service does NOT offer a WSDL by itself already, right?
So what do you know exactly about this service then? Because, if you only know the URL of where to invoke the service without any additional specification (and again, if the service does NOT publish it's WSDL itself already, like on the same URL with an appended ?wsdl), I guess you don't really have any basis to create something from.
So some more info required here I guess...
The usage for Java2WSDL is explained here. It requires Java classes or interfaces describing the web service for it to do the translation (i.e. you can't just give it a SOAP request/response and hope it'll work it out from there). WSDL2Java can generate Java client-side bindings when given a WSDL (which is probably useless if you want to write a .NET web service client). All of this can be done without running a Java application server (because you're not actually hosting the web service, you're just describing its inputs and outputs).
Therefore, if you wanted to go down this path, what you'd have to do is work out the server-side interfaces in Java, and use Java2WSDL to generate the WSDL. From there, you can feed the WSDL into Visual Studio as per the KB article you linked.
I can promise you now that it will be fiddly getting the interfaces correct. Regardless of whether you can get the inputs and outputs correct, there's still the matter of Document vs. RPC and all kinds of other parameters that might not be readily apparent from looking at SOAP requests/responses.
whoAfter lots of reading and research, I found this little gem: http://wscfblue.codeplex.com/ It took the XSD and generated a WSDL file and can also generate the proxy code if you choose. I don't have everything working end to end yet but I thought I'd go ahead a post this for anyone else you might have a similar question. If I remember, I'll post back any notes on this once I'm done.
Related
Recently I read the article http://www.ibm.com/developerworks/library/ws-noide1/ and this prompted me to review my knowledge of just how the SOA had evolved in the last decade or so. The review was a nice refresher however I soon discovered some gaps in my knowledge.
In particular I want to know, and could not find a definitive answer for wheather WSDL files are necessary regardless of which protocol, paradigm, or API is used in providing the web service. Is the creation and propagation of these files done by the servlet containers such as tomcat , jetty etc in the background?
Essentially HTTP protocol itself for example does not require a WSDL which leads me to believe that WSDL is a specification closely coupled to SOAP and that perhaps EJB, Spring, etc do not use require it.
I know similar questions to this have been asked such as JSON, REST, SOAP, WSDL, and SOA: How do they all link together
but I haven't been able to find a definitive answer to this specific question.
If you take a closer look to the Java specification you'll have a clue of what is clearly the WSDL.
When you build a Web Service in Java you have several way to do it.
SOAP, spec Jax-WS : this standard is kind of strict. It order to communicate with it you have to respect a contract. This contract, named the WSDL, is an XML that define how to reach the WS, which parameters are needed and what are their types. This file is provided by the service and most of modern IDE would generate it but you have to provide it to your client so it can call the WS respecting the contract.
REST, spec Jax-RS : this standard is far less strict as you have no contract. This provide an URL over a specific HTTP method (GET, POST, PUT, DELETE). To make a call to this kind of WS, just call it and you'll see what happen.
Queue JMS : this is a kind of different as the two others but seems important to me as it provide a way to create messaging reliable, decoupled et asynchronous. It is based on a connection factory to deals with the communication.
These standard are implemented in most of the main technologies today. Java EE with its EJB has implementation for the three of them, as do Spring.
SOA provides many ways to communicate now, depending on what are your needs.
I hope I helped, don't hesitate to ask if needed.
EDIT:
To explain use case I'll try to set up an example... It's a kind of hard exercise and not perfect but I hope it will help you.
Consider, you work for a house seller. You have three different call to WS: 1. you confirm a sale on your website, 2. you search in your catalog, 3 you inform your boss via a small message on the intranet.
I precise that using three different type of WS is not compulsory.
This action is really important for your workflow. Data that are
sent must arrived. You must be sure to respect what is expected on
the WS. Client side and server side must be perfectly matching.
You'll use SOAP because there is a specific contract between these
two sides.
For this you don't need a specific and rigid contract. Searching is just easy and does not need a structure with defined arguments. Just get data and print it on the screen. Here REST is maybe more suitable because it is easier to set up and if modification are needed, there is no contract to modify on client side.
For messaging, you want to send the message and that's all. JMS are queues waiting for "message". These messages are requests that will be consume asynchronously. The message will be stored waiting for a consumer to take them in the queue order (FIFO).
The generation of the WSDL is your task. It will generate an xml file based on your Java code of the WS. Notice that the contrary is possible too, if you have a WSDL you can generate the Java from it(see this. Most of the time you have an url corresponding to your WSDL file so it can be accessed from your client.
You can generate WSDL from the IDE. But I'm not sure using Maven is the right way. The WSDL is your contract, it may be the one you based your WS on. The generation with IDE is just a way to make your life easier but at the end the WSDL may not change a lot. If it does then maybe SOAP is not what you need. REST may be more "agile".
Look at these links for manually generation with IDE (IntelliJ, Eclipse) or with external tool WSGEN.
I wanna consume some web services, but I don't wanna use any method where eclipse or other code generation mechanism to generate any SOAP client classes for me.
I want something similar to ksoap (the one I used a loooong time ago when playing with J2ME), which enable me (freely) to create a SOAP request and parse SOAP response, without the need of using generated client codes.
I did some search on this issues in this forum too, but most are advising to use code generation method, and that is not what I'm looking for.
Any suggestion will be appreciated.
Thanks in advance,
Bromo
Never mind, I found what I'm looking for here in Github, and it really suit to my requirements.
sudzc is a very good online tool to get a bundled API for sending request to a SOAP service and get response from service using WSDL link of that webservice. I want to know is there is anything available like sudzc for java?
I'm also looking for something like this - there seem to be plenty of WSDL-to-Java utilities out there but most are unmaintained or don't support Android. The closest I can find is this Android ksoap2 stub generator. It appears like the perfect thing but I've not had a great deal of success with it (the generated code is very hit-or-miss), but that might be my WSDL files. Hopefully you have more luck with it.
Would SoapUI do what you need? It's very useful as an interactive testing tool, but it also interfaces with different Java libraries (Axis, Jax, etc) to create Web Services Java code.
I know that there are two ways of creating web services:
Write wsdl first and generate java interface using web services tools like wsdl2java
Write java code first and then use tool to generate wsdl.
For me, the first method looks complex and second looks quite easy relatively. If so, I want to know
When is the first method used? Give me scenario where the first method is preferred over second.
What is the advantage of first method over second?
Which is the method which is widely used in industry for application programming?
If I am looking for a job in web services development, is it necessary for me to know how to write wsdl file for given requirements.
Sometimes you need to declare the interface upfront before you have any implementation - for example you might have to negotiate it with the customer so that he can start coding against it ASAP. Then you start with WSDL.
If you don't need to have a WSDL representation as early as possible you can follow whatever procedure is convenient for you. For example, if you develop an ASP.NET web service it's quite convenient to just write C# code and have the runtime to generate the WSDL on consumer request.
I'm completely stuck and need your help... I've created a webservice stub with jaxb 2.x for a service that sends a binary file (base64 encoded jpg images) within a soap message. Everything worked fine and I was able to receive and display the images, until I tried to export the eclipse RCP app to a product, which caused imediatly LinkageErrors (as usual, javax.xml.namespace.QName and some more).
I was able to solve that problem to 'rebundle' axis2 and now everything works fine again - except the parsing of the binary file part within the stub, which now causes an exception (unexpected element).
A closer look revealed, that the reader (OMStAXWrapper), that is used in the axis2-jaxb-generated Stub, now does not read the whole base64 text but only the first 10000 bytes. Then it doesn't find the correct ending of the element and throws an exception.
As mentioned before - this didn't happen in the beginning, so I hope it's just a parameter or an option. Big thanks in advance for every help or hint!
Edit
It wasn't JAXB, I used JAXWS and wsimport to create the stub for the wsdl file...
For a bit of background, OMStAXWrapper is part of Axiom, which is Axis2's custom streaming utility for web services, which Axis2 uses as a replacement for SAAJ. I wouldn't be hugely surprised if it was buggy, if my prior experience with Axis is anything to go by.
If you want to send large binaries over SOAP, the best technology for this at the moment seems to be MTOM (see here for how to use it with Axis2). This can better optimize the binary representation, and your problem might go away. However, both client and server must be able to speak MTOM, so it may not be an option for you.
Alternatively, it should be possible to convince Axis2 to use the standard SAAJ API instead of using Axiom. SAAJ is slower, but should be less buggy.
My final suggestion is to abandon Axis2 for your client, and use something more lightweight. Spring-WS provides a very nice client API, which is currently my tool of choice for talking to remote web services. It supports Axiom and SAAJ, as well as MTOM, and it sufficiently lightweight that it's quite easy to find out why something's gone wrong.