ASP.NET and Web Services Part 2 - Referencing the Namespace
(Page 7 of 8 )
By doing this, the WSDL file assigns the prefix wsdlns to reference the namespace. This prefix fully qualifies all references to entities combined within the document. In addition, it sets prefixes for the <types> element as well as the XSD Schema. The <definitions> element sets boundaries for a specified name. All elements declared within the WSDL file define entities for messages and ports. Assign entities utilizing the Name attribute.
In a production environment, it is imperative to change the target namespace to your own. The temporary namespace displayed in the WSDL document, for example,
targetNamespace
="http://tempuri.org/"
xmlns=http://schemas.xmlsoap.org/wsdl/
specifies the http://tempuri.org namespace. It is better to do the following:
targetNamespace
="http://IFCEBrokerageFirm.com/"
xmlns="http://schemas.xmlsoap.org">
Returning to Listing 10, the <types> element contains XSD Schema information contained within the WSDL file. For example, examine the following document segment, and observe how the schema element appears as an immediate child of <types>. In addition, <types> functions as a container for XSD Schema complex types.
<s:element
name="StockQuote">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="symbol"
type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
The same is true for StockQuoteResponse. Its type is s:double.
The <message> element contains two parts, the message name and the part name. The message name is StockQuoteSOAPIn. The part name is parameters, and the element is s0:StockQuote. Notice that the message segment contains both a
<message name="StockQuoteSoapIn">
and a
<part name="parameters" element="s0:StockQuote"
/>
</message>
<message
name="StockQuoteSoapOut">
- The <message> element contains descriptions for logical elements of messages.
- The <part> represents a parameter passed to the method.
- The <portType> element defines a list of operations, each individually assigned to a specified <operation> child element. In this case, SecuritiesExchange SOAP is the portType name. The <operation> name is StockQuote. The input and output messages are
s0
:StockQuoteIn
and
s0
:StockQuoteOut
Remember: This is part one of chapter 7 .NET & J2EE Interoperability, by Dwight Peltzer (McGraw-Hill/Osborne, ISBN 0-07-223054-1, 2004). If you like what you see, feel free to click on the following link to get your own copy! Buy this book now.
|
Next: Implementing Interfaces >>
More ASP.NET Articles
More By McGraw-Hill/Osborne