Pg. 97 Basic examples of SOAP message
<?xml version=”1.0”?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”>
<SOAP-ENV:Body>
<getQuote xmlns=”http://namespaces.cafeconleche.org/xmljava/ch2/”>
<symbol>RHAT</symbol>
</getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Example 2.25. A Master Schema for
SOAP Trading documents, with SOAP encoding dropped
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/">
<!-- Standard SOAP
schemas -->
<xsd:include
schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"
/>
<!--
Local schema -->
<xsd:import schemaLocation="trading.xsd"
namespace="http://namespaces.cafeconleche.org/xmljava/ch2/"
/>
</xsd:schema>
This imports
a schema and never defines a prefix for it, but such a prefix would be for use
in declarations needing it, which don’t exist here. This schema comes into play for the body of
the message:
Part of SOAP
Envelope schema handling <Body>, pg. 971 in Appendix B
<xs: any namespace=”##any” minOccurs=”0”
maxOccurs=”unbounded” processContents=”lax”>
Where the “lax”
means try to locate a schema and use it, but don’t fail if you can’t find it.
Slightly
simplified: update operation removed. Local names that are referred to
from other places by QName are in bold and comments
show what namespace they are being put into.
Note that the app has two namespaces
(this is not required—they could be merged into one.)
<wsdl:definitions xmlns:tns=http://quickstart.samples/quotes/ ß
app's WSDL service NS
xmlns:ns=http://quickstart.samples/quotes/xsd/ ß
app’s message schema NS
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://quickstart.samples/quotes/">
<wsdl:types> ß
Works like imported schema
(can
use <import … > here instead)
<xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema
ß<schema> inside
<schema>!
elementFormDefault="qualified"
targetNamespace="http://quickstart.samples/quotes/xsd/">
<xs:element name="getPrice"> à
ns: NS
<xs:complexType>
<xs:sequence>
<xs:element name="symbol"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPriceResponse"> à
ns: NS
<xs:complexType>
<xs:sequence>
<xs:element name="return"
type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPriceMessage"> ßMessage
format
<wsdl:part name="part1"
element="ns:getPrice" /> ß use of ns: name
</wsdl:message>
<wsdl:message name="getPriceResponseMessage">
<wsdl:part name="part1"
element="ns:getPriceResponse" /> ß
use of ns: name
</wsdl:message>
<!-- SEI =
service endpoint interface, the WS-provided API -->
<wsdl:portType name="StockQuoteSEI"> çHow
to call “getPrice” WS
<wsdl:operation name="getPrice">
<wsdl:input message="tns:getPriceMessage" />
<wsdl:output message="tns:getPriceResponseMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StockQuoteServiceSOAP11Binding"
type="tns:StockQuoteSEI">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
ßusing HTTP here
style="document"
/>
<wsdl:operation name="getPrice">
<soap:operation soapAction="" style="document" />
<wsdl:input>
<soap:body use="literal"
/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"
/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!—The final service spec, referenced from tools given these
names à
<wsdl:service name="StockQuoteService">
<wsdl:port name="StockQuoteServiceSOAP11port_http"
binding="tns:StockQuoteServiceSOAP11Binding">
<soap:address location="APP_SERVER_WILL_REPLACE_WITH_ACTUAL_URL"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>