国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > 綜合 > 正文

SOAP協(xié)議規(guī)范(二)

2024-07-21 02:29:12
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

以下是描述上面結(jié)構(gòu)的schema片斷:  

<element  name="book"  type="tns:book"/>
<complextype  name="book">
<!--  either  the  following  group  must  occur  or  else  the
href  attribute  must  appear,  but  not  both.  -->
<sequence  minoccurs="0"  maxoccurs="1">
<element  name="title"  type="xsd:string"/>
<element  name="firstauthor"  type="tns:person"/>
<element  name="secondauthor"  type="tns:person"/>
</sequence>
<attribute  name="href"  type="urireference"/>
<attribute  name="id"  type="id"/>
<anyattribute  namespace="##other"/>
</complextype>
<element  name="person"  base="tns:person"/>
<complextype  name="person">
<!--  either  the  following  group  must  occur  or  else  the
href  attribute  must  appear,  but  not  both.  -->
<sequence  minoccurs="0"  maxoccurs="1">
<element  name="name"  type="xsd:string"/>
<element  name="address"  type="tns:address"/>
</sequence>
<attribute  name="href"  type="urireference"/>
<attribute  name="id"  type="id"/>
<anyattribute  namespace="##other"/>
</complextype>
<element  name="address"  base="tns:address"/>
<complextype  name="address">
<!--  either  the  following  group  must  occur  or  else  the
href  attribute  must  appear,  but  not  both.  -->
<sequence  minoccurs="0"  maxoccurs="1">
<element  name="street"  type="xsd:string"/>
<element  name="city"  type="xsd:string"/>
<element  name="state"  type="xsd:string"/>
</sequence>
<attribute  name="href"  type="urireference"/>
<attribute  name="id"  type="id"/>
<anyattribute  namespace="##other"/>
</complextype>  

5.4.2  數(shù)組
soap數(shù)組定義為具有"soap-enc:array"類型或一個(gè)從"soap-enc:array"衍生的類型(參見(jiàn)規(guī)則8)。數(shù)組表示為元素值,對(duì)元素的名沒(méi)有特別的約束(正如元素值并不約束它們所屬的元素)。數(shù)組可以包含任意類型的元素,包括嵌套數(shù)組。可以創(chuàng)建新的類型(受soap-enc:array
類型限制)來(lái)表示數(shù)組,如整數(shù)數(shù)組或某些用戶定義的枚舉。數(shù)組值表示為組成這個(gè)數(shù)組的項(xiàng)的元素的規(guī)則序列。在數(shù)組值中,元素名對(duì)于區(qū)分accesor并不重要。元素可以有任意的名。實(shí)際上,元素常常用它們?cè)趕chema中暗示或確定的數(shù)組類型來(lái)命名元素。并且一般情況下對(duì)于復(fù)合值來(lái)說(shuō),如果數(shù)組中數(shù)組項(xiàng)的值是single-reference值,則這個(gè)數(shù)組項(xiàng)包含它的值,否則,該數(shù)組項(xiàng)通過(guò)"href"屬性引用這個(gè)值。下面的例子是一個(gè)整型數(shù)組的schema片斷:  

<element  name="myfavoritenumbers"
type="soap-enc:array"/>
<myfavoritenumbers
soap-enc:arraytype="xsd:int[2]">
<number>3</number>
<number>4</number>
</myfavoritenumbers>  

在這個(gè)例子中,數(shù)組"myfavoritenumbers"包括幾個(gè)成員,每個(gè)成員是一個(gè)類型為soap-enc:int的值。注意soap-enc:array允許不受限制的元素名,它們不傳達(dá)任何類型信息,所以在使用時(shí),或者它們有xsi:type屬性,或者它們所屬的元素有soap-enc:arraytype屬性。自然,由soap-enc:array衍生的類型可以聲明局部元素,但這種情況下要包括類型信息。上面已經(jīng)提到,soap-enc  schema包含了元素的聲明,元素名與"xml  schema  part  2:  datatypes"規(guī)范[11]中的簡(jiǎn)單類型一致。其中包括了對(duì)"array"的聲明。于是,我們可以這樣寫(xiě):  

<soap-enc:array  soap-enc:arraytype="xsd:int[2]">
<soap-enc:int>3</soap-enc:int>
<soap-enc:int>4</soap-enc:int>
</soap-enc:array>  

數(shù)組可以包含特定arraytype的任意子類型的實(shí)例。即,數(shù)組成員可以是arrytype屬性值指定的類型的任意子類型,這個(gè)類型對(duì)于arraytype屬性中指定的類型來(lái)說(shuō)是可替換的(根據(jù)schema中的替換規(guī)則)。例如,一個(gè)整型數(shù)組可以包含從整型衍生的任意類型(如"int"或任意用戶定義的從整型衍生的類型)。同樣,一個(gè)"address"數(shù)組可能包含一個(gè)address的受限類型或擴(kuò)展類型如"internationaladdress"。因?yàn)樘峁┑膕oap-enc:array類型允許任意類型的成員,所以可以包含任意類型的混合除非使用arraytype屬性加以特別的限制。在實(shí)例中,可以使用xsi:type指定成員元素的類型,或通過(guò)schema中成員元素的聲明來(lái)指定。下面是兩個(gè)例子。  

<soap-enc:array  soap-enc:arraytype="soap-enc:ur-type[4]">
<thing  xsi:type="xsd:int">12345</thing>
<thing  xsi:type="xsd:decimal">6.789</thing>
<thing  xsi:type="xsd:string">
of  mans  first  disobedience,  and  the  fruit
of  that  forbidden  tree,  whose  mortal  tast
brought  death  into  the  world,  and  all  our  woe,
</thing>
<thing  xsi:type="xsd:urireference">http://www.dartmouth.edu/~milton/reading_room/  </thing>
</soap-enc:array>
<soap-enc:array  soap-enc:arraytype="soap-enc:ur-type[4]">
<soap-enc:int>12345</soap-enc:int>
<soap-enc:decimal>6.789</soap-enc:decimal>
<xsd:string>
of  mans  first  disobedience,  and  the  fruit
of  that  forbidden  tree,  whose  mortal  tast
brought  death  into  the  world,  and  all  our  woe,
</xsd:string>
<soap-enc:urireference>http://www.dartmouth.edu/~milton/reading_room/  </soap-enc:urireference  >
</soap-enc:array>  

數(shù)組值可以是結(jié)構(gòu)或其它復(fù)合值。例如"xyz:order"結(jié)構(gòu)數(shù)組:  

<soap-enc:array  soap-enc:arraytype="xyz:order[2]">
<order>
<product>apple</product>
<price>1.56</price>
</order>
<order>
<product>peach</product>
<price>1.48</price>
</order>
</soap-enc:array>  

數(shù)組成員值也可以是數(shù)組。下例是兩個(gè)字符串?dāng)?shù)組組成的數(shù)組:  

<soap-enc:array  soap-enc:arraytype="xsd:string[][2]">
<item  href="#array-1"/>
<item  href="#array-2"/>
</soap-enc:array>
<soap-enc:array  id="array-1"  soap-enc:arraytype="xsd:string[2]">
<item>r1c1</item>
<item>r1c2</item>
<item>r1c3</item>
</soap-enc:array>
<soap-enc:array  id="array-2"  soap-enc:arraytype="xsd:string[2]">
<item>r2c1</item>
<item>r2c2</item>
</soap-enc:array>  

包含數(shù)組的元素?zé)o需命名為"soap-enc:array"。它可以有任意的名,只要元素的類型是soap-enc:array或由之衍生的類型。例如,下面是一個(gè)schema片斷和與之一致的數(shù)組實(shí)例。  

<simpletype  name="phonenumber"  base="string"/>
<element  name="arrayofphonenumbers">
<complextype  base="soap-enc:array">
<element  name="phonenumber"  type="tns:phonenumber"  maxoccurs="unbounded"  />
</complextype>
<anyattribute/>
</element>
<xyz:arrayofphonenumbers  soap-enc:arraytype="xyz:phonenumber[2]">
<phonenumber>206-555-1212</phonenumber>
<phonenumber>1-888-123-4567</phonenumber>
</xyz:arrayofphonenumbers>  

數(shù)組可能是多維的。在這種情況下,在arraytype屬性的asize部分將不止有一個(gè)值:  

<soap-enc:array  soap-enc:arraytype="xsd:string[2,3]">
<item>r1c1</item>
<item>r1c2</item>
<item>r1c3</item>
<item>r2c1</item>
<item>r2c2</item>
<item>r2c3</item>
</soap-enc:array>  

雖然上面的例子把數(shù)組編碼為獨(dú)立的元素,但元素值也可以是嵌入形式,而且若元素值是single  reference時(shí),必須編碼為嵌入形式。下例是一個(gè)schema片斷,電話號(hào)碼數(shù)組嵌入到一個(gè)類型為"person"的結(jié)構(gòu)中,并且通過(guò)accessor  "phone-numbers"訪問(wèn)它:  

<simpletype  name="phonenumber"  base="string"/>
<element  name="arrayofphonenumbers">
<complextype  base="soap-enc:array">
<element  name="phonenumber"  type="tns:phonenumber"  maxoccurs="unbounded"/>
</complextype>
<anyattribute/>
</element>
<element  name="person">
<complextype>
<element  name="name"  type="string"/>
<element  name="phonenumbers"  type="tns:arrayofphonenumbers"/>
</complextype>
</element>
<xyz:person>
<name>john  hancock</name>
<phonenumbers  soap-enc:arraytype="xyz:phonenumber[2]">
<phonenumber>206-555-1212</phonenumber>
<phonenumber>1-888-123-4567</phonenumber>
</phonenumbers>
</xyz:person>  

下面的例子中,數(shù)組值為single-reference,被編碼為嵌入元素,包含它的元素名即為入口名:  

<xyz:purchaseorder>
<customername>henry  ford</customername>
<shipto>
<street>5th  ave</street>
<city>new  york</city>
<state>ny</state>
<zip>10010</zip>
</shipto>
<purchaselineitems  soap-enc:arraytype="order[2]">
<order>
<product>apple</product>
<price>1.56</price>
</order>
<order>
<product>peach</product>
<price>1.48</price>
</order>
</purchaselineitems>
</xyz:purchaseorder>  

5.4.2.1  部分儲(chǔ)值(partially  transmitted)數(shù)組
soap提供了對(duì)部分儲(chǔ)值(partially  transmitted)數(shù)組的支持,如某些上下文中的可變數(shù)組。一個(gè)partially  transmitted  數(shù)組由一個(gè)"soap-enc:offset"屬性(從第一個(gè)transmitted的元素開(kāi)始的偏移量,基于0)指示。如果省略,偏移量取0。下面的例子中數(shù)組的大小為5,但只有從0起,第三和第四個(gè)元素被儲(chǔ)值。  

<soap-enc:array  ;soap-enc:arraytype="xsd:string[5]"  ;soap-enc:offset="[2]">
<item>the  third  element</item>
<item>the  fourth  element</item>
</soap-enc:array>  

5.4.2.2  稀疏數(shù)組sparse  arrays
soap提供了對(duì)稀疏數(shù)組的支持。每個(gè)表示成員值的元素包含一個(gè)"soap-enc:position"屬性,用來(lái)指示它在數(shù)組中的位置。下例是兩維字符串稀疏數(shù)組的例子,數(shù)組大小是4,但只用到第2個(gè)。  

<soap-enc:array  soap-enc:arraytype="xsd:string[,][4]">
<soap-enc:array  href="#array-1"  soap-enc:position="[2]"/>
</soap-enc:array>
<soap-enc:array  id="array-1"  soap-enc:arraytype="xsd:string[10,10]">
<item  soap-enc:position="[2,2]">third  row,  third  col</item>
<item  soap-enc:position="[7,2]">eighth  row,  third  col</item>
</soap-enc:array>  

如果對(duì)array-1的引用僅發(fā)生在數(shù)組內(nèi)部,上例也可以編碼如下:  

<soap-enc:array  soap-enc:arraytype="xsd:string[,][4]">
<soap-enc:array  soap-enc:position="[2]"  soap-enc:arraytype="xsd:string[10,  10]>
<item  soap-enc:position="[2,2]">third  row,  third  col</item>
<item  soap-enc:position="[7,2]">eighth  row,  third  col</item>
</soap-enc:array>
</soap-enc:array>  

5.4.3  一般復(fù)合類型
在這里提到的編碼規(guī)則不僅僅限于accessor名已知的情況,如果accessor名是運(yùn)行環(huán)境下實(shí)時(shí)獲得的,編碼規(guī)則同樣適用,也就是說(shuō)accessor編碼成一個(gè)元素名與accessor名匹配的元素,同時(shí)accessor可能包含或者引用該元素的值。如果accessor包含類型不能事先確定的值,它必須包含一個(gè)合適的屬性xsi:type  。類似地,上述引用的規(guī)則已經(jīng)足夠用于復(fù)合類型的序列化,這些復(fù)合類型可能包含用名區(qū)分的accessors(結(jié)構(gòu))和用名及序數(shù)位置區(qū)分的accessors。(可能包含重復(fù)的accessor)  實(shí)際上這并不要求任何schema模式包含這些類型,但更為準(zhǔn)確的說(shuō)法是:一個(gè)類型模型(type-model)schema如果有這些類型,就可以構(gòu)造一個(gè)符合x(chóng)ml句法規(guī)則的schema和xml文檔實(shí)例。  

<xyz:purchaseorder>
<customername>henry  ford</customername>
<shipto>
<street>5th  ave</street>
<city>new  york</city>
<state>ny</state>
<zip>10010</zip>
</shipto>
<purchaselineitems>
<order>
<product>apple</product>
<price>1.56</price>
</order>
<order>
<product>peach</product>
<price>1.48</price>
</order>
</purchaselineitems>
</xyz:purchaseorder>  

類似地,將一個(gè)結(jié)構(gòu)上類似數(shù)組但實(shí)際上不是一個(gè)  soap-enc:array類型或者  soap-enc:array子類型的復(fù)合值序列化同樣是允許的,例如:  

<purchaselineitems>
<order>
<product>apple</product>
<price>1.56</price>
</order>
<order>
<product>peach</product>
<price>1.48</price>
</order>
</purchaselineitems>  

5.5  缺省值
省略accessor元素意味著或者有一個(gè)缺省值或者值不知道。具體細(xì)節(jié)依靠這個(gè)accessor,方法和上下文。例如,對(duì)于多態(tài)accessor,省略accessor一般意味著一個(gè)null值。同樣,省略布爾accessor一般意味著false值或者值不知道,省略數(shù)字accessor一般意味著值為零或者值不知道。  

5.6  soap  root屬性
soap  root  屬性可用于標(biāo)記一個(gè)序列化root,從而一個(gè)對(duì)象可以反序列化(deserialized),而實(shí)際上該root并不是真正的對(duì)象root。這個(gè)屬性有兩個(gè)可選值"1"  or  "0"。對(duì)象真正的roots屬性值為“1”  ,序列化root但不是真正的root屬性值也為“1”,元素如果要顯式地指定不能為序列化root,只需將該屬性設(shè)置為“0”  soap  root屬性可以出現(xiàn)在soap頭和soap體元素的任意子元素中。(譯者注:soap  root屬性為0的元素不是一個(gè)獨(dú)立的實(shí)體,外部的應(yīng)用不能訪問(wèn)到該元素,但該元素可以被soap文檔本身的其它元素訪問(wèn)到)soap  root屬性可以出現(xiàn)在soap頭和soap體元素的任意子元素中。這個(gè)屬性沒(méi)有缺省值。  

6.  在http中使用soap
這一節(jié)講述了如何在http中使用soap。把soap綁定到http,無(wú)論使用或不用http擴(kuò)展框架,都有很大的好處:在利用soap的形式化和靈活性的同時(shí),使用http種種豐富的特性。在http中攜帶soap消息,并不意味著soap改寫(xiě)了http已有的語(yǔ)義,而是將構(gòu)建在http之上soap語(yǔ)義自然地對(duì)應(yīng)到http語(yǔ)義。soap自然地遵循h(huán)ttp的請(qǐng)求/應(yīng)答消息模型使得soap的請(qǐng)求和應(yīng)答參數(shù)可以包含在http請(qǐng)求和應(yīng)答中。注意,soap的中間節(jié)點(diǎn)與http的中間節(jié)點(diǎn)并不等同,即,不要期望一個(gè)根據(jù)http連接頭中的域?qū)ぶ返降膆ttp中間節(jié)點(diǎn)能夠檢查或處理http請(qǐng)求中的soap消息。
在http消息中包含soap實(shí)體時(shí),按照rfc2376[3]  http應(yīng)用程序必須使用媒體類型  "text/xml"。

6.1  soap  http請(qǐng)求
雖然soap可能與各種http請(qǐng)求方式相結(jié)合,但是綁定僅定義了在http  post請(qǐng)求中包含soap消息。(第7節(jié)中描述了如何在rpc中使用soap,第6.3節(jié)描述了如何使用http擴(kuò)展框架)  

6.1.1  http頭中soapaction域
一個(gè)http請(qǐng)求頭中的soapaction域用來(lái)指出這是一個(gè)soap  http請(qǐng)求,它的值是所要的uri。在格式、uri的特性和可解析性上沒(méi)有任何限制。當(dāng)http客戶發(fā)出soap  http請(qǐng)求時(shí)必須使用在http頭中使用這個(gè)域。  

soapaction  =  "soapaction"  ":"  [  <">  uri-reference  <">  ]
uri-reference  =  <as  defined  in  rfc  2396  [4]>  

http頭中soapaction域使服務(wù)器(如防火墻)能正確的過(guò)濾http中soap請(qǐng)求消息。如果這個(gè)域的值是空字符串(""),表示soap消息的目標(biāo)就是http請(qǐng)求的uri。這個(gè)域沒(méi)有值表示沒(méi)有soap消息的目標(biāo)的信息。例子:  

soapaction:  "http://electrocommerce.org/abc#mymessage"
soapaction:  "myapp.sdl"
soapaction:  ""
soapaction:  

6.2  soap  http應(yīng)答
soap  http遵循h(huán)ttp  中表示通信狀態(tài)信息的http狀態(tài)碼的語(yǔ)義。例如,2xx狀態(tài)碼表示這個(gè)包含了soap組件的客戶請(qǐng)求已經(jīng)被成功的收到,理解和接受。在處理請(qǐng)求時(shí)如果發(fā)生錯(cuò)誤,soap  http服務(wù)器必須發(fā)出應(yīng)答http  500  "internal  server  error",并在這個(gè)應(yīng)答中包含一個(gè)soap  fault元素(見(jiàn)4.4節(jié))表示這個(gè)soap處理錯(cuò)誤。  

6.3  http擴(kuò)展框架
一個(gè)soap消息可以與http擴(kuò)展框架  [6]一起使用以區(qū)分是否有soap  http請(qǐng)求和它的目標(biāo)。是使用擴(kuò)展框架或是普通的http關(guān)系到通信各方的策略和能力。通過(guò)使用一個(gè)必需的擴(kuò)展聲明和"m-"http方法名前綴,客戶可以強(qiáng)制使用http擴(kuò)展框架。服務(wù)器可以使用http狀態(tài)碼510  "not  extended"強(qiáng)制使用http擴(kuò)展框架。也就是說(shuō),使用一個(gè)額外的來(lái)回,任何一方都可以發(fā)現(xiàn)另一方的策略并依照?qǐng)?zhí)行。用來(lái)表示soap使用了擴(kuò)展框架的擴(kuò)展標(biāo)志符是http://schemas.xmlsoap.org/soap/envelope/  

6.4  soap  http舉例
例3  使用post的soap  http  

post  /stockquote  http/1.1
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
soapaction:  "http://electrocommerce.org/abc#mymessage"
<soap-env:envelope...
http/1.1  200  ok
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope...  

例4  使用擴(kuò)展框架的soap  http  

m-post  /stockquote  http/1.1
man:  "http://schemas.xmlsoap.org/soap/envelope/";;  ns=nnnn
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
nnnn-soapaction:  "http://electrocommerce.org/abc#mymessage"
<soap-env:envelope...
http/1.1  200  ok  

ext:
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope...  

7.  在rpc中使用soap
設(shè)計(jì)soap的目的之一就是利用xml的擴(kuò)展性和靈活性來(lái)封裝和交換rpc調(diào)用。這一節(jié)定義了遠(yuǎn)程過(guò)程調(diào)用和應(yīng)答的統(tǒng)一表示形式。雖然可以預(yù)計(jì)到這種表示形式最可能被用于與第5節(jié)中定義的編碼方式相結(jié)合,但也可能有其它的表示形式。soap的encodingstyle屬性(見(jiàn)4.3.2節(jié))可以用來(lái)表明方法調(diào)用和應(yīng)答都使用這一節(jié)所指定的表示方式。在rpc中使用soap和soap協(xié)議綁定(見(jiàn)第6節(jié))是緊密相關(guān)的。在使用http作為綁定協(xié)議時(shí),一個(gè)rpc調(diào)用自然地映射到一個(gè)http請(qǐng)求,rpc應(yīng)答同樣映射到http應(yīng)答。但是,在rpc中使用soap并不限于綁定http協(xié)議。
要進(jìn)行方法調(diào)用,以下的信息是必需的:  

目標(biāo)對(duì)象的uri
方法名
方法signature(可選)
方法的參數(shù)
頭數(shù)據(jù)(可選)
soap依靠協(xié)議綁定提供傳送uri的機(jī)制。例如,對(duì)http來(lái)說(shuō),請(qǐng)求的uri指出了調(diào)用的來(lái)源  。除了必須是一個(gè)合法的uri之外,soap對(duì)一個(gè)地址的格式?jīng)]有任何限制。(更多uri的信息參見(jiàn)  [4])  

7.1  rpc和soap體
rpc方法調(diào)用和應(yīng)答都包含在soap  body元素中(見(jiàn)4.3節(jié)),它們使用如下的表示形式:  

一個(gè)方法調(diào)用用一個(gè)結(jié)構(gòu)表示
一個(gè)方法調(diào)用被看作一個(gè)單個(gè)的結(jié)構(gòu),每個(gè)[in]和[in/out]參數(shù)有一個(gè)accessor。結(jié)構(gòu)的名和類型與方法相同。每個(gè)[in]和[in/out]參數(shù)都被看作一個(gè)accessor,這個(gè)accessor的名和類型與參數(shù)的名和類型相對(duì)應(yīng)。它們的出現(xiàn)順序和方法中定義的參數(shù)順序相同。
一個(gè)方法應(yīng)答用一個(gè)結(jié)構(gòu)表示。
一個(gè)方法應(yīng)答被看作一個(gè)單個(gè)的結(jié)構(gòu),返回值和每個(gè)[in]和[in/out]參數(shù)有一個(gè)accessor。第一個(gè)accessor是返回值,之后是參數(shù)accessor,參數(shù)accessor的出現(xiàn)順序和方法中定義的參數(shù)順序相同。每個(gè)參數(shù)accessor的名稱和類型與參數(shù)的名稱和類型相對(duì)應(yīng)。返回值accessor的名稱并不重要。同樣,結(jié)構(gòu)的名稱也不重要,不過(guò),通常在方法名稱的后面加上字符串"response"作為結(jié)構(gòu)的名稱。
方法錯(cuò)誤使用soap  fault元素(見(jiàn)4.4節(jié))表示。如果綁定的協(xié)議有額外的規(guī)則表示錯(cuò)誤,則這些規(guī)則也必須要遵從。正如上面所述,方法調(diào)用和應(yīng)答結(jié)構(gòu)可以按照第5節(jié)中規(guī)則編碼,或者用encodingstyle屬性(見(jiàn)4.1.1節(jié))指定編碼方式。應(yīng)用程序可以處理缺少參數(shù)的請(qǐng)求,但是可能返回一個(gè)錯(cuò)誤。因?yàn)榉祷亟Y(jié)果表示調(diào)用成功,錯(cuò)誤表示調(diào)用失敗,所以,在方法應(yīng)答中同時(shí)包含返回結(jié)果和錯(cuò)誤是錯(cuò)誤的。  

7.2  rpc和soap頭
在rpc編碼中,可能會(huì)有與方法請(qǐng)求有關(guān)但不是正規(guī)的方法signature的附加信息。如果這樣,它必須作為soap頭元素的子元素。使用這種頭元素的一個(gè)例子是在消息中傳遞事務(wù)id。由于事務(wù)id不是方法signature的一部分,通常由底層的組件而不是應(yīng)用程序代碼控制,所以沒(méi)有一種直接的方法在調(diào)用中傳遞這個(gè)必要的信息。通過(guò)在頭中添加一個(gè)給定名字的條目,接收方的事務(wù)管理器就可以析取這個(gè)事務(wù)id,而且不影響遠(yuǎn)程過(guò)程調(diào)用的代碼。  

8.  安全性考慮
這篇文檔中沒(méi)有涉及完整性和保密性,這些問(wèn)題將在以后的版本中描述。  

9.  參考文獻(xiàn)
[1]  s.  bradner,  "the  internet  standards  process  --  revision  3",  rfc2026,  harvard  university,  october  1996
[2]  s.  bradner,  "key  words  for  use  in  rfcs  to  indicate  requirement  levels",  rfc  2119,  harvard  university,  march  1997
[3]  e.  whitehead,  m.  murata,  "xml  media  types",  rfc2376,  uc  irvine,  fuji  xerox  info.  systems,  july  1998
[4]  t.  berners-lee,  r.  fielding,  l.  masinter,  "uniform  resource  identifiers  (uri):  generic  syntax",  rfc  2396,  mit/lcs,  u.c.irvine,  xerox  corporation,  a  ugust  1998.
[5]  r.  fielding,  j.  gettys,  j.  c.  mogul,  h.  frystyk,  t.  berners-lee,  "hypert  ext  transfer  protocol  --  http/1.1",  rfc  2616,  u.c.  irvine,  dec  w3c/mit,  dec,w3c/mit,  w3c/mit,  january  1997
[6]  h.  nielsen,  p.  leach,  s.  lawrence,  "an  http  extension  framework",  rfc  2774,  microsoft,  microsoft,  agranat  systems
[7]  w3c  recommendation  "the  xml  specification"
[8]  w3c  recommendation  "namespaces  in  xml"
[9]  w3c  working  draft  "xml  linking  language".  this  is  work  in  progress.
[10]  w3c  working  draft  "xml  schema  part  1:  structures".  this  is  work  in  progress.
[11]  w3c  working  draft  "xml  schema  part  2:  datatypes".  this  is  work  in  progress.
[12]  transfer  syntax  ndr,  in  "dce  1.1:  remote  procedure  call"
[13]  n.  freed,  n.  borenstein,  "multipurpose  internet  mail  extensions  (mime)part  one:  format  of  internet  message  bodies",  rfc2045,  innosoft,  first  virtu  al,  november  1996  

10。  附錄
a.  soap封裝舉例  

a.1  請(qǐng)求編碼舉例  

例5  類似于例1,但有一個(gè)必要的頭  

post  /stockquote  http/1.1
host:  www.stockquoteserver.com
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
soapaction:  "some-uri"
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
soap-env:encoding_blank" encoding>http://schemas.xmlsoap.org/soap/encoding/";/>
<soap-env:header>
<t:transaction
xmlns:t="some-uri"
soap-env:mustunderstand="1">
5
</t:transaction>
</soap-env:header>
<soap-env:body>
<m:getlasttradeprice  xmlns:m="some-uri">
<symbol>def</symbol>
</m:getlasttradeprice>
</soap-env:body>
</soap-env:envelope>  

例6  類似于例1,但有多個(gè)請(qǐng)求參數(shù)  

post  /stockquote  http/1.1
host:  www.stockquoteserver.com
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
soapaction:  "some-uri"
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
soap-env:encoding_blank" encoding>http://schemas.xmlsoap.org/soap/encoding/";/>
<soap-env:body>
<m:getlasttradepricedetailed
xmlns:m="some-uri">
<symbol>def</symbol>
<company>def  corp</company>
<price>34.1</price>
</m:getlasttradepricedetailed>
</soap-env:body>
</soap-env:envelope>  

a.2  應(yīng)答編碼舉例  

例7  與例2類似,但有必要的頭部  

http/1.1  200  ok
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
soap-env:encoding_blank" encoding>http://schemas.xmlsoap.org/soap/encoding/";/>
<soap-env:header>
<t:transaction  xmlns:t="some-uri"  xsi:type="xsd:int"  mustunderstand="1">  5  </t:transaction>
</soap-env:header>
<soap-env:body>
<m:getlasttradepriceresponse  xmlns:m="some-uri">
<price>34.5</price>
</m:getlasttradepriceresponse>
</soap-env:body>
</soap-env:envelope>  

例8  與例2類似,但有一個(gè)結(jié)構(gòu)  

http/1.1  200  ok
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
soap-env:encoding_blank" encoding>http://schemas.xmlsoap.org/soap/encoding/";/>
<soap-env:body>
<m:getlasttradepriceresponse
xmlns:m="some-uri">
<priceandvolume>
<lasttradeprice>  34.5  </lasttradeprice>
<dayvolume>  10000  </dayvolume>
</priceandvolume>
</m:getlasttradepriceresponse>
</soap-env:body>
</soap-env:envelope>  

例9  與例2類似,但處理必要的頭出錯(cuò)  

http/1.1  500  internal  server  error
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";>
<soap-env:body>
<soap-env:fault>
<faultcode>soap-env:mustunderstand</faultcode>
<faultstring>soap  must  understand  error</faultstring>
</soap-env:fault>
</soap-env:body>
</soap-env:envelope>  

例10  與例2類似,但處理body出錯(cuò)  

http/1.1  500  internal  server  error
content-type:  text/xml;  charset="utf-8"
content-length:  nnnn
<soap-env:envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";>
<soap-env:body>
<soap-env:fault>
<faultcode>soap-env:server</faultcode>
<faultstring>server  error</faultstring>
<detail>
<e:myfaultdetails  xmlns:e="some-uri">
<message>
my  application  didn't  work
</message>
<errorcode>  1001  </errorcode>
</e:myfaultdetails>
</detail>
</soap-env:fault>
</soap-env:body>
</soap-env:envelope>


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 阳春市| 新干县| 仪陇县| 泉州市| 西乌珠穆沁旗| 故城县| 寿光市| 铜山县| 裕民县| 铁岭县| 宜城市| 呼伦贝尔市| 安丘市| 清远市| 盐池县| 津市市| 洛南县| 集贤县| 桃园县| 虎林市| 专栏| 武邑县| 彰化市| 安岳县| 平罗县| 石屏县| 昌江| 肇庆市| 新晃| 望城县| 乌拉特前旗| 门源| 上杭县| 岳普湖县| 永和县| 易门县| 南充市| 蕲春县| 天等县| 宜兴市| 托里县|