บทความ:
Perl
PHP
HTML
CSS
XML
DTD
XSD
RSS
WSDL
Linux
Site Map
Board
Connect Us: facebooktwitter

Binding to SOAP

นนทชัย ทรัพย์ทวีพงศ์ 2009-08-02 16:35:16  ให้คะแนนบทความนี้(0)  ลดคะแนนบทความ(0)  จำนวน Comment(0)  จำนวนคนอ่าน(461)  

ตัวอย่างของการกำหนด Binding to SOAP

<message name="getTermRequest">
	<part name="term" type="xs:string" />
</message>

<message name="getTermResponse">
	<part name="value" type="xs:string" />
</message>

<portType name="glossaryTerms">
	<operation name="getTerm">
		<input message="getTermRequest" />
		<output message="getTermResponse" />
	</operation>
</portType>

<binding type="glossaryTerms" name="b1">
	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
	<operation>
		<soap:operation soapAction="http://example.com/getTerm" />
		<input><soap:body use="literal" /></input>
		<output><soap:body use="literal" /></output>
	</operation>
</binding>

binding element ประกอบไปด้วย attributes 2 ตัวคือ name และ types

ซึ่ง attribute name (สามารถใช้ชื่ออะไรก็ได้ตามต้องการ ไม่จำเป็นต้องใช้ b1) เป็นการกำหนดชื่อของ binding และ attribute type เป็นตัวกำหนดว่าต้องการ binding ไปที่ port ใด ในตัวอย่างนี้จะทำการ binding ไปที่ portType ที่ชื่อว่า "glossaryTerms"

ส่วน soap:binding element ประกอบไปด้วย attribute 2 ตัวเช่นกัน ก็คือ style และ transport

ซึ่ง attribute style สามารถเป็น rpc หรือ document ก็ได้ ในตัวอย่างนี้จะใช้ document ส่วนใน attribute transport จะเป็นตัวกำหนด SOAP protocol ที่ใช้ ในตัวอย่างนี้จะใช้ HTTP เป็น SOAP protocol

ส่วน operation element จทำการนิยาม operation แต่ละตัวที่ภายใน port นั้นได้ระบุไว้

ซึ่งแต่ละ operation จะต้องกำหนด SOAP action ที่คล้ายกัน นอกจากนี้ยังต้องระบุด้วยว่า input และ output ของ operation นั้น ๆ ถูก encoded ด้วยอะไร ในตัวอย่างนี้ใช้ "literal"

แหล่งที่มา: www.w3schools.com

Related Article

Related Download

ไม่มีรายการดาวน์โหลด


Login  Login
ค้นหา  Search