2016-09-21 64 views
0

有没有人可以解释soap请求xml架构中<req:xxx><ns1:xxx>用法之间的区别。SOAP请求中的<req:xxx>和<ns1:xxx>有什么区别

例如: -

第一SOAP请求XML模式

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://olp.bank.com/payement/service/olppaymentmanager/req"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <req:initiatePaymentDetailsReq> 
     <olpIdAlias>****</olpIdAlias> 
     <merchantId>****</merchantId> 
     <merchantRefNum>234324</merchantRefNum> 
     <paymentAmount>200</paymentAmount> 
     <paymentCurrency>SAR</paymentCurrency> 
     <dynamicMerchantLandingURL></dynamicMerchantLandingURL> 
     <dynamicMerchantFailureURL></dynamicMerchantFailureURL> 
     </req:initiatePaymentDetailsReq> 
    </soapenv:Body> 
</soapenv:Envelope> 

第二XML请求模式使用<req:>例如

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:brsmembersapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <SOAP-ENV:Body> 
    <ns1:ValidateMemberLogin> 
     <login xsi:type="ns1:LoginCredentials"> 
     <clientAPIVersion xsi:type="xsd:int">0</clientAPIVersion> 
     <username xsi:type="xsd:string">someapiusername</username> 
     <password xsi:type="xsd:string">someapipassword</password> 
     </login> 
     <memberLogin xsi:type="ns1:MemberLoginCredentials"> 
     <username xsi:type="xsd:string">somememberusername</username> 
     <password xsi:type="xsd:string">somememberpassword</password> 
     </memberLogin> 
     </ns1:ValidateMemberLogin> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 
在第一肥皂请求

: - 在第二<req:initiatePaymentDetailsReq>肥皂请求<ns1:>例如: - <ns1:ValidateMemberLogin> 它们之间有什么不同。

回答

1

命名空间前缀不同的事实纯粹是美丽的,您可以选择任何您喜欢的名称空间前缀,因为它的唯一目的是充当名称空间URI的本地缩写。

但这两个消息使用不同的名称空间URI的事实是非常重要的。 (一个使用http://olp.bank.com/payement/service/olppaymentmanager/req,另一个使用urn:brsmembersapi)这意味着这两个消息使用完全不同的词汇表,由不同的人定义,意思是不同的东西。

当没有相似性时,很难“解释差异” - 这就像要求解释考古学和博若莱之间的区别。

+0

谢谢@Michael Kay。当第一个SOAP请求与PHP代码集成在一起时,我面临一个问题(http://stackoverflow.com/questions/39571363/how-to-create-soap-client-in-php)。第二次成功完成。我认为这个问题的原因是

相关问题