开发者

generate WSDL from java WS

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 plac开发者_运维技巧e. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜