为了详细说明这个问题,我可以用定义替换命名空间定义吗?
这仍然是格式正确的XML吗?它们是上下文中的“相同”消息,还是第二条格式仍然正确的SOAP XML消息,就像原始消息一样。
例如,这是来自Oracle示例的格式正确的SOAP XML消息。然后,我将对其进行复制,但将SOAP-ENV
属性替换为其定义:
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
因此SOAP-ENV
,由引用定义定义"http://schemas.xmlsoap.org/soap/envelope/"
的替换。
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<http://schemas.xmlsoap.org/soap/envelope/:Header/>
<http://schemas.xmlsoap.org/soap/envelope/:Body>
<http://schemas.xmlsoap.org/soap/envelope/:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Message does not have necessary info</faultstring>
<faultactor>http://gizmos.com/order</faultactor>
<detail>
<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value</PO:order>
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code</PO:confirmation>
</detail>
</http://schemas.xmlsoap.org/soap/envelope/:Fault>
</http://schemas.xmlsoap.org/soap/envelope/:Body>
</http://schemas.xmlsoap.org/soap/envelope/:Envelope>
不,您建议用名称空间URI替换名称空间前缀的语法不是格式正确的XML。但是,某些软件支持某些功能:
<{http://schemas.xmlsoap.org/soap/envelope/}Envelope />
这通常称为克拉克符号。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句