Hello,
What is the best solution (if any) for calling a vb.net web service with Java / JSP? If anyone could point me to any examples / references I would very much appreciate it.
Thanks!
Hello,
What is the best solution (if any) for calling a vb.net web service with Java / JSP? If anyone could point me to any examples / references I would very much appreciate it.
Thanks!
This totally depends on what kind of web service you are talking about (RESTful vs. SOAP, etc.). In theory, the whole point of having a web service is to provide this kind of interoperability, so it should definitely be possible. However, without more details its hard to point you in the right direction.
Really, this question has nothing to do with VB.net, since the client should not need to be exposed to any of the service implementation details.
EDIT: Since its a SOAP service, you should be able to create a client based off the service's WSDL. There are a variety of tools to help with this. Here is a tutorial on generating Java code from a WSDL using the WSDL2Java utility.
Java frameworks you should take a look at:
If by "VB.NET web service", you mean an ASP.NET Web Service (.asmx file extension), you should be able to consume that with Java with a Soap client.
Each ASP.NET web service will expose its public contract for that service via a WSDL (Web Service Definition Language) file, which you can access by simply adding ?WSDL
after the .asmx
of the web service's address. The key benefit behind web services based on common protocols such as SOAP is that they allow software to communicate across machine and platform boundaries. The WSDL file is the contract that exists between the software applications to make sure they communicate in the same language.
A good client library will read that WSDL file and will handle the plumbing of communicating with the web service via SOAP-based XML messages. If you really wanted to, you could even hand-craft your SOAP XML messages and communicate via a simple HTTP client. However, it would be best to use a library that already exists to handle your SOAP plumbing. This lets your application consume the functionality of the web service while making sure you adhere to the web service contract.
For Java to connect to the .NET Web service, it will require that you first generate a WSDL. This can be done by prepending ?WSDL
to the .asmx web service (.NET), e.g. http://localhost:8080/myApp/myService.asmx?WSDL
For Java to understand this, you will need a Web Service client: In Java 6, the JAX-WS is the latest specification.
The following client that conforms to the JAX-WS is:
These tools allows you to create a java proxy from the WSDL definition. In java 6 (in JDK_HOME/bin folder) there are tools (now standard) to convert a WSDL definition to java proxy. The wsimport (windows) allows such operation.
Once you have a java proxy, you can basically call all the exposed web service methods created to call your web service.