[xml] Question regarding xmlAddId



Hello!

I'm having some problems using xmlAddId. My problem is that I need to sign documents
using XMLSEC and the wsu:Id-attribute (in soap:Body below) cannot be found by 
xpointer unless I add a DTD. I have been told however that one should not (may not?) 
use a DTD in SOAP documents and that is the reason why I want to use xmlAddId. 
Below is the XML that I try to sign but I haven't been able to find a call to xmlAddId 
that will work. The DTD look like this:

<!DOCTYPE soap:Envelope [
<!ATTLIST soap:Body Id ID #IMPLIED>
]>

What should I use for xmlAttrPtr and what should I use for "value" to xmlAddId in order
to replace the DTD? I have tried every combination that I could think of. 
Another strange thing is that apparently I have to reload the whole tree before 
xpointer will "see" the wsu:Id attribute. I think this is because I build the whole
tree in code and there is a problem (bug?) in XMLLIB regarding DTD's. 

Thanks for your help,

Erik F. Andersen


<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 <soap:Header>
  <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"; 
  soap:mustUnderstand="1">
   <Signature xmlns="http://www.w3.org/2000/09/xmldsig#";>
     <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> 
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> 
       <Reference URI="#Id-058b5a86-a1dd-4188-9920-8315c3f84eae">
        <Transforms>
         <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> 
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"; /> 
        <DigestValue /> 
       </Reference>
     </SignedInfo>
    </Signature>
   </wsse:Security>
  </soap:Header>
  <soap:Body xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility";
   wsu:Id="Id-058b5a86-a1dd-4188-9920-8315c3f84eae">
  </soap:Body>
</soap:Envelope>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]