How can I access the exposed methods in a .wsdl
file using Java? Also, what are the steps involved in writing a Java client and consuming the webservices?
Generate the client code as follows: In the Project Explorer, right-click your client project's WSDL file, and then select WebLogic Web Services > Generate Web Service Client from the drop-down menu, as Figure 1 shows. This will open the New Web Service Client dialog that Figure 2 shows.
In addition to The Elite Gentleman's answer, here are my steps I successfully used to generate classes to be able to use the webservice: Command:
wsimport -Xnocompile -keep -b binding.xml wsdlFile.wsdl
Explanation:
I had the problem that the Java classes contained the JAXBElement<Type>
wrapper classes.
So instead of a class member of type String
, I would get the type JAXBElement<String>
, which is horrible to use. With the -b
switch for wsimport
and the following binding.xml
file, you get the correct types:
<jaxb:bindings version="2.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings>
<jaxb:globalBindings generateElementProperty="false" />
</jaxb:bindings>
</jaxb:bindings>
I hope this helps. wsimport
then generates all the classes you need as well as a class containing methods for all your webservices' methods.
By default, these methods don't have a read timeout (talking network problems while requesting...), see here for a question I had back then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With