WSDL file detailed (posted) under

Source: Internet
Author: User
Tags abstract abstract definition definition constant soap web services xmlns wsdl
When this article is written, there is no SOAP in it, and it can be used as an industry-name download. This is important for Java-enabled clients, because the interface used by the Java server will take advantage of Java's multiple downloads. But this is not so much about the client that uses COM because COM doesn't support downloading.

<binding> <operation> Elements
The Binding area is where you specify the communication protocol, serialization, and encoding. If the Types, Messages, and PortType sections are responsible for abstract information, then the Binding section is responsible for the processing of the data. The Binding section is responsible for the abstraction of the first three sections.

The sense that the connection is separated from the data and information announcements is that the service provider that performs the same business can portType a group of businesses (s). Each provider can provide an additional custom link if it is to highlight its own differences. It is good for WSDL to have a construct; because in this way, you can leave bindings and Services sections, abstract definitions in their own files, and can be scattered in the service providers, so that they set the abstract definition as standard. For example, a bank can be standardized, a group of abstract WSDL files to explain the details of the banking industry. But each bank is also free to "customize" the basics of messaging, sequencing, and encoding.

The following is a copy of the WSDL download example for the Binding section, which is repeated to facilitate detailed discussion:

<binding name= "foosamplebinding" type= "Wsdlns:foosampleporttype" >
<stk:binding preferredencoding= "UTF-8"/>
<soap:binding style= "RPC"
transport= "Http://schemas.xmlsoap.org/soap/http"/>
<operation name= "foo" >
<soap:operation soapaction= "Http://tempuri.org/action/foo1"/>
<input name= "Foo1" >
<soap:body use= "encoded"
Namespace= "http://tempuri.org/message/"
encodingstyle=
"http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
</operation>
<operation name= "foo" >
<soap:operation soapaction= "Http://tempuri.org/action/foo2"/>
<input name= "Foo2" >
<soap:body use= "encoded"
Namespace= "http://tempuri.org/message/"
encodingstyle=
"http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
</operation>
</binding>

The <binding> element will have a name (in this case "foosamplebinding") to facilitate the <port> element participation in the Services section. It has a reference <portType> "type", in this case the "wsdlns:foosampleporttype". The second line is the MSTK2-<stk:binding&gt, which can specify preferredencoding, or "utf-8".

<soap:binding> elements can be specified, using the same type (RPC) and the transport. The transport will participate in the naming space to make sure that the HTTP SOAP communication protocol is used.

There are two <operation> elements with the same name called "foo". The difference between these two professions is the two different <input> names: "foo1" and "foo2". The "soapaction" of the,<soap:operation> element in both <operation> elements is the same, and is a URI. SOAPAction is a soap-specialized URI and is used verbatim by SOAP messages. The SOAP message obtained in this way has a soapaction, and it is also valued as a URI in the <soap:operation> element. Although HTTP connectivity requires SOAPAction, non-HTTP connections are not required. When this article is published, its use is still unknown. For this example, it seems that it can be used to differentiate between two different "foo". SOAP 1.1 declares that SOAPAction can be used to realize the "purpose (intent)" of information. It is more recommended for the servo side, which can be used to route messages without parsing the entire message. In fact, the use of the difference is very large. The <soap:operation> element may also contain another term called "style", which can be used if the specific industry needs to overwrite the type specified in the <soap:binding> element.

The <input>, <output>, and <fault> elements contained in the <operation> element can be applied to the same elements in the Porttypes area. The only <input> elements that appear in the previous example. In this case, each of these three elements has a choice of "name" that can be used to name the same industry. In the <input> element of the example, there is a <soap:body> element that specifies the contents of the <body> of the input SOAP messages. This element has the following attributes:

Use
It is used to specify the data as "code (encoded)" or "constant value (literal)". The meaning of "constant value" is that the information contained in a SOAP message is formatted in exactly the specified specification of abstract definition (Types, Messages, and Porttypes section). The meaning of "code" is that the "encodingstyle" (reference below) specifies the way of encoding.
Namespace
Each SOAP message's main body has its own named space to prevent the name conflict. The URI specified by this nature is used verbatim in the result SOAP message.
Encodingstyle
In the way SOAP is encoded, the value of the URI should be "http://schemas.xmlsoap.org/soap/encoding".
File type
In the previous section,,<soap:binding> elements have a type that is set to "rpc". If you set this to "document", you can change the order of messages on the line. At this point the message becomes a document transfer, not a letter signature. In this type of connection, the,<message> element is a defined file format, not a letter signature. Please refer to the WSDL fragment in the following example:

<definitions
Xmlns:stns= "(Schematns)"
Xmlns:wtns= "(Wsdltns)"
Targetnamespace= "(wsdltns)" >

<schema targetnamespace= "(schematns)"
elementformdefault= "qualified" >
<element name= "simpleelement" type= "Xsd:int"/>
<element name= "compositelement" type= "Stns:compositetype"/>
<complextype name= "Compositetype" >
<all>
<element name= ' A ' type= "Xsd:int"/>
<element name= ' B ' type= "xsd:string"/>
</all>
</complexType>
</schema>

<message...>
<part name= ' p1 ' type= ' Stns:compositetype '/>
<part name= ' p2 ' type= ' Xsd:int '/>
<part name= ' p3 ' element= ' stns:simpleelement '/>
<part name= ' P4 ' element= ' stns:compositeelement '/>
</message>
?</definitions>

This structure describes two elements, simpleelement and compositeelement, and a declarative type (Compositetype). The only <message> elements declared are four parts (part): P1 is Compositetype type, p2 is int type, p3 is simpleelement, and P4 is compositeelement. The following table is the comparison of four links, according to "Use/type": Rpc/literal, Document/literal, rpc/encoded, and document/encoded. This table shows how each link is reflected in the online reality.

Rpc/literal
<operation name= "method1" style= "RPC" ...>
<input>
<soap:body parts= "P1 p2 p3 P4"
Use= "literal"
Namespace= "(messagens)"/>
</input>
</operation>

Online Scenario:
<soapenv:body ... xmlns:mns= "(Messagens)"
Xmlns:stns= "(schematns)" >
<mns:method1>
<mns:p1>
<stns:a>123</stns:a>
<stns:b>hello</stns:b>
</mns:p1>
<mns:p2>123</mns:p2>
<mns:p3>

<stns:SimpleElement>

123

</stns:SimpleElement>
</mns:p3>
<mns:p4>
<stns:CompositeElement>
<stns:a>123</stns:a>
<stns:b>hello</stns:b>
</stns:CompositeElement>
</mns:p4>
</mns:method1>
</soapenv:body>
Document/literal/type=
<operation name= "Method1"
style= "Document" ...>
<input>
<soap:body parts= "P1" use= "literal" >
</input>
</operation>

Online Scenario:

<soapenv:body xmlns:stns= "(schematns)" >
<stns:a>123</stns:a>
<stns:b>hello</stns:b>
</soapenv:body>

rpc/encoded
<operation name= "method1" style= "RPC" ...>
<input>
<soap:body parts= "p1 p2" use= "encoded"
encoding=
"http://schemas.xmlsoap.org/soap/encoding/"
Namespace= "(messagens)"/>
</input>
</operation>

Online Scenario:
<soapenv:body xmlns:mns= "(messagens)" >
<mns:method1>
&LT;P1 target= "_self" href= "#1"/>
<p2>123</p2>
</mns:method1>
<mns:compositetype id= "#1" >
<a>123</a>
<b>hello</b>
</mns:CompositeType>
</soapenv:body>
Document/literal/element=
<operation name= "Method1"
style= "Document" ...>
<input>
<soap:body parts= "P3 P4"

use= "literal" >
</input>
</operation>

Online Scenario:

<soapenv:body xmlns:stns= "(schematns)" >
<stns:SimpleElement>

123

</stns:SimpleElement>
<stns:CompositeElement>
<stns:a>123</stns:a>
<stns:b>hello</stns:b>
</stns:CompositeElement>
</soapenv:body>

document/encoded
<operation name= "Method1"
style= "Document" ...>
<input>
<soap:body parts= "p1 p2" use= "encoded"
encoding=

"http://schemas.xmlsoap.org/soap/encoding/"
Namespace= "(messagens)"/>
</input>
</operation>

Online Scenario:
<soapenv:body xmlns:mns= "(messagens)" >
<mns:CompositeType>
<a>123</a>
<b>hello</b>
</mns:CompositeType>
<soapenc:int>123</soapenc:int>
</soapenv:body>


<service> <port> Elements
Service is a group of <port> elements. Each <port> element is connected to a position and <binding> in one way or another. If there is more than one <port> element, and the same <binding> connection, you can use the other URL as a substitute.

In a WSDL file, you can have more than one <service> element. Many <service> elements can be used for many purposes. One of them is to group the transport groups according to the destination of the URL. So I just use another <service> will be able to reset the price requirements for all stocks, and my client program will still work, because in this kind of service group, the communication protocol will not be more mobile service. Another use of many <service> services is that, depending on the basis of the message, the transport is divided into different types. For example, all HTTP ports can be placed on one <service>; all SMTP ports for another <service>. The client can then search for the opposite <service> according to the communication that it can handle.

<service name= "Fooservice" >
<port name= "Foosampleport" binding= "foosamplebinding" >
<soap:address
location= "Http://carlos:8080/fooService/foo.asp"/>
</port>
</service>

The "name" of,<service> in a WSDL file can distinguish between different services. Because a service is likely to have several ports, the transport must also have "name".

Total
This article has illustrated the most obvious SOAP features of the WSDL file. But it should be clear that the WSDL is not only about SOAP on HTTP. On SOAP, the WSDL's ability to express is absolutely sufficient to use Http-post, Http-get, SMTP, and other communication protocol. As long as the WSDL is used, it is the programmer or the general user who can easily handle SOAP. People are convinced that the integration of WSDL and SOAP will lead to a new type of application to make more use of the various Web services.

There are various kinds of XML elements in the namespace of the WSDL. The following table collates these elements, attributes, and contents for reference:

Elements of content (sub)
<definitions> Name
TargetNamespace
xmlns (other name space) <types>
<message>
<portType>
<binding>
<service>
<types> (NO) <xsd:schema>
<message> name <part>
<portType> name <operation>
<binding> Name
Type <operation>
<service> name <port>
<part> Name
Type (null value)
<operation> Name
Parameterorder <input>
<output>
<fault>
<input> Name
Message (null value)
<output> Name
Message (null value)
<fault> Name

Message (null value)
<port> Name
Binding <soap:address>

Resource:
WSDL 1.1
SOAP 1.1
XML Structure Description Entry
MS SOAP Toolkit Download Web site
Translator tools for IDL to WSDL
Free web resource for Proxy generators with WSDL to VB
Pocketsoap:soap components, tools, and source code


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.