soap请求中的名称空间前缀是否正确?



在调用web服务时,期望客户端为名称空间发送特定的前缀。否则,返回故障码。

下面是返回错误代码的请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.connector.uut.cs.com.tr/">
<soapenv:Header>
<se:Security xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<se:UsernameToken>
<se:Username>XXXX</se:Username>
<se:Password>XXXX</se:Password>
</se:UsernameToken>
</se:Security>
</soapenv:Header>
<soapenv:Body>
<ser:kayitliKullaniciListeleExtended>
<urun>EFATURA</urun>
<gecmisEklensin></gecmisEklensin>
</ser:kayitliKullaniciListeleExtended>
</soapenv:Body>
</soapenv:Envelope>

鉴于此请求有效:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.connector.uut.cs.com.tr/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>XXXX</wsse:Username>
<wsse:Password>XXXX</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<ser:kayitliKullaniciListeleExtended>
<urun>EFATURA</urun>
<gecmisEklensin></gecmisEklensin>
</ser:kayitliKullaniciListeleExtended>
</soapenv:Body>
</soapenv:Envelope>

两个请求之间的唯一区别是名称空间前缀(有效的是wsse,其他前缀都失败)。要求客户端为名称空间传递特定的前缀是正确的实现吗?

我期望前缀名称可以是任何东西,只要xmlns:标识的uri是正确的。

你说得对。名称空间很重要,而前缀可以改变。您可以将命名空间前缀看作"局部变量"。

最新更新