Search code examples
javasoapjax-wscxfjaxb2

How do you call a web service in Java with only XSD and NO WSDL?


I have a web service outside of my company that provides no WSDL for their service. They do provide:

  • a detailed document on how to POST to their service
  • what a SoapEnvelope should look like
  • and even an .xsd that I can use to create the message to put in the SOAP <env:Body></env:Body> of the call.

How do you make a SOAP call to a web service without a WSDL (in Java)? I need a tool that can take my JAXB-formatted XML message, wrap it in a SOAP Envelope, and send it as HTTP POST to some web service (with SSL and Certificates).

Are there tools that make this easy? I've looked at CXF with JAX-WS dispatch briefly, but since most examples and documentation expect a wsdl document, I am not sure if CXF is what I should be using.


Solution

  • Did they give you the URL? Try to surf to http://the-url-of-service-that-does-not-provide-wsdl/wsdl

    this is the standard URL where you should download the WSDL file (unless they coded everything by hand).

    OK, if not you have 2 ways

    1. Create the WSDL yourself based on their document.

    2. Parse the SOAP XML using any tool you know. For example JAXB, Digester, DOM