Search code examples
javaweb-serviceswsdlsoap-client

What is the recommended way to consume a soap web service when wsdl is not discoverable in java


So far we have discovered to access/consume the soap web service are as follows

  1. Generate client from wsdl file(with additional xsd)
  2. Simple http post call with soap body (HttpUrlConnection)
  3. Using SAAJ (Creating soap body with child elements)

For Generated client(No. 1) it works if the wsdl is discoverable from url. But it fails if the wsdl is not discoverable from url.

Now my question is, is it always recommended to consume the soap web service (where wsdl is not discoverable) using way No. 2 or No. 3? Or are there other flexible solutions?


Solution

  • If you are using SpringWS then you can work with wsdl which is not discoverable. Please check this below link for details :

    InaccessibleWSDLException error from SOAP generated client in JAVA

    The beauty of this approach is you don't have to prepare your request , instead you can use request and response object.