I don开发者_Python百科't know how to call a .NET Web Service as there is a requirement in my application that calls the .NET Web Service and login in that by calling the login method which gives some token. Please provide me a link that solves this problem or give me a sample code for it.
You may take a look at Apache Axis which allows you to consume SOAP web services no matter what language they have been written in.
You must use the WSDL to communicate with the web service.
The most frequent approach is to use a framework (cxf, jax-ws or axis) to create client stubs from the WSDL and then use this stubs in your application code.
Since you have a Swing application your user could press a button to log to the web service (as your requirement) and the action handler would call the service method that would communicate with the web service.
If you check on any of the above frameworks there are a lot of tutorials.
As a trivial example in your case you could do a wsimport
(shipped in java) on the WSDL of the .NET service to create the client stubs. Check them out. And then you could do something like
Service myService = Service.create(wsdl,serviceName);
MyPort port = myService.getPort(....);
//use port to call methods inside your GUI
port.methodX();
Since you use a swing GUI make sure you do NOT call the methods from EDT otherwise GUI will freeze
精彩评论