0
我试图对节点businessEntity进行数字签名。我在转换中使用Xpath来引用此节点。如何在节点测试中选择本地名称
我的XPath表达式是:
ancestor-or-self::ns1:businessEntity[
@businessKey = 'uddi:testSignedProviderlastime'
] and not(ancestor-or-self::ns1:businessService)
and not(ancestor-or-self::ds:Signature)
我想删除的命名空间前缀NS1的依赖。有没有办法可以做到这一点?或者有没有一种方法可以在我的表达式中指定名称空间URI。
我已经尝试用替换命名空间前缀ns1,但因使用“”前缀而出现错误。 赞赏修改这个表达式的任何帮助。
感谢, 索尼娅
以下是XML,我将这种改造过:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<ns1:save_business xmlns:ns1="urn:uddi-org:api_v3">
<ns1:authInfo>something
</ns1:authInfo>
<ns1:businessEntity businessKey="uddi:testSignedProviderlastime" xmlns:ns1="urn:uddi-org:api_v3">
<ns1:name>testSignedProviderlastime</ns1:name>
<ns1:description>Not Provided</ns1:description>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:Reference URI="" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transforms xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:XPath xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ns1="urn:uddi-org:api_v3">ancestor-or-self::ns1:businessEntity[@businessKey='uddi:testSignedProviderlastime'] and not (ancestor-or-self::ns1:businessService) and not (ancestor-or-self::ds:Signature)</ds:XPath>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">something</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
something
</ds:SignatureValue>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
something
</ds:X509Certificate>
</ds:X509Data>
<ds:KeyValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:RSAKeyValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Modulus xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
something
</ds:Modulus>
<ds:Exponent xmlns:ds="http://www.w3.org/2000/09/xmldsig#">AQAB</ds:Exponent>
</ds:RSAKeyValue>
</ds:KeyValue>
</ds:KeyInfo>
</ds:Signature>
</ns1:businessEntity>
</ns1:save_business>
</soapenv:Body>
非常感谢。这有帮助。祝你有美好的一天 – ssanghavi 2011-03-02 20:37:08
@ssangavi。不用谢。但请注意,在此我们通过接受答案表达我们的感谢。只需点击答案左上角的复选标记即可。 – Flack 2011-03-02 20:40:12