views:

142

answers:

5

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.

A: 

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.

thelost
yea, so that was the first thing I tried. However, my understanding is that VS generates a proxy for you based on WSDL which as I noted, this service doesn't have one.
nelsonwebs
A: 

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...

weiresr
no, the service does not have a WSDL. what do I have? that is a good question. I have a PDF spec that is supposed to have all the methods and parameters and I have a partial (and inaccurate) xsd schema file.
nelsonwebs
alright, in that case I can't imagine that there is any tool which can do the job for you - because you'd need to have at least *some* sort of well-defined (i.e., automatically processable) spec for this to be possible. XSD would already be a good start, but if it's not complete and inaccurate as you say...A tool such as javatowsdl would also require a some sort of existing Java interface/implementation to create a WSDL from...
weiresr
The WSTK referenced in the link was supposed to be able to inspect the java interface and generate a wsdl but is no longer around. Apparently, apache axis2 or CXF has something called java2wsdl which can also do something similar. However, it is unclear to me what the requirements are for using the tool and if it even works well. Thus the specific question still is, does anyone know of tool that works on windows that will inspect the java interface to generate a wsdl or does anyone know specifically how to use the java2wsdl tool in apache (could it be run from windows)?
nelsonwebs
A: 

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.

Catchwa
yea, from my additional reading I think you are right. Who knew this was going to be such a pain. And to think that I thought that the idea of interop was about making it easy. :) And to your notes, I think it will be easier to do this manually than go through the brain damage trying to stand on my head to generate a wsdl like you are describing.
nelsonwebs
+1  A: 

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.

Pratik Bhatt
Hopefully this works. If it does, you've just saved him a bucketload of pain. Also, if `?wsdl` doesn't work, try `?WSDL`
Catchwa
yea, I've tried those. The documentation I have from them also says explicitly they don't provide a wsdl. not very nice of them. :)
nelsonwebs
A: 

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.

nelsonwebs