How do you use SOAP to communicate with WSDL? (i.e web services written in java)
SOAP and WSDL are related and complementary standards for web services, and they are typically used together.
SOAP is an XML messaging protocol. The SOAP specification describes the format and structure of an "envelope" that conveys an XML message, and it specifies how to "bind" the SOAP envelope to various communication protocols, such as HTTP. SOAP also defines some basic rules about processing the messages in a SOAP envelope.
WSDL is a service description language. It describes the interface of the service, i.e., the structure of the XML messages that the service can accept/return. WSDL also describes how those messages are encoded and indicates what protocols the service supports (e.g., SOAP over HTTP).
If you're familiar with CORBA, SOAP is like IIOP, and WSDL is like IDL. WSDL provides a programmatic description of the service. A tool can parse the WSDL and generate SOAP middleware code.
When building web services in Java, a developer typically uses a web services framework that generates the SOAP code. Popular open source web services frameworks for Java include Apache Axis2, Apache CXF, and Sun's JAX-WS reference implementation. All Java EE application servers also include a web services framework. The specific tooling used to generate the code is framework-specific:
- Apache Axis2 provides Java2WSDL and WSDL2Java tools.
- Apache CXF provides a WSDL2Java tool and supports WSDL generation from Java using annotations and a Java2WSDL tool. (Note that although the Axis2 and CXF tools have the same name, the tools are different and generate different code.)
- Sun's JAX-WS supports WSDL generation from Java using annotations and the apt and wsgen tools, and Java generation from WSDL using the wsimport tool.
All three frameworks also use configuration files for specifying runtime settings and mapping SOAP/XML constructs to Java constructs.
Dig Deeper on Topics Archive
Related Q&A from Anne Thomas Manes
Anne Thomas Manes explains the differences between open source clients and open source implementations. Continue Reading
Anne Thomas Manes discusses the best way to go about creating an enterprise data dictionary and why the systems works well. Continue Reading
Anne Thomas Manes explains the difference between 'hard' real time and 'live' real time systems. Continue Reading