You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Prakasa Nedunuri <pn...@cisco.com> on 2005/02/18 03:04:46 UTC

Namespace problem

Hi,
   I am trying to encrypt and decrypt SOAP body using xmlsec library.
Before encrypting, my original SOAP message is

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
   <StockQuoteRequest 
xmlns="http://stockservice.contoso.com/wse/samples/2003/06">
         <symbols>
                 <Symbol>FABRIKAM</Symbol>
                 <Symbol>CONSTOSO</Symbol>
         </symbols>
         <symbols1>
                 <Symbol>CSCO</Symbol>
                 <Symbol>JNPR</Symbol>
         </symbols1>
         <symbols2>
                 <Symbol>ttt</Symbol>
                 <Symbol>ppp</Symbol>
         </symbols2>
    </StockQuoteRequest>
   </soapenv:Body>
</soapenv:Envelope>

However, after I decrypt the message, I see that StockQuoteRequest element 
has additional namespaces which are
not present in the original message before encrypting.
  <StockQuoteRequest 
xmlns="http://stockservice.contoso.com/wse/samples/2003/06" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<symbols>
<Symbol>FABRIKAM</Symbol>
<Symbol>CONSTOSO</Symbol>
</symbols>
         <symbols1>
<Symbol>CSCO</Symbol>
<Symbol>JNPR</Symbol>
</symbols1>
<symbols2>
<Symbol>ttt</Symbol>
<Symbol>ppp</Symbol>
</symbols2>
    </StockQuoteRequest>

Any reason why the additional namespaces are getting added to 
StockQuoteRequest element?
Anyway I can retain the original message without having these namespaces 
getting added.

Thanks,
Prakasa

Re: Namespace problem

Posted by Raul Benito <ra...@gmail.com>.
Explicetly use exclusive c14n instead of the default inclusive one.


On Fri, 18 Feb 2005 09:50:00 -0800, Prakasa Nedunuri <pn...@cisco.com> wrote:
>  Hi Vishal,
>    Is there anyway I can bypass this problem?
>  Thanks,
>  Prakasa
> 
>  
>  At 02:40 PM 2/18/2005 +0530, Vishal Mahajan wrote:
>  
> Hi Prakasa,
>  
>  This happens because the encryption code internally uses a
> canonicalization-based serializer. During canonicalization the namespace
> attributes are cascaded down the root node.
>  
>  Vishal
>  
>  Prakasa Nedunuri wrote: 
>  
> Hi,
>    I am trying to encrypt and decrypt SOAP body using xmlsec library.
>  Before encrypting, my original SOAP message is
>  
>  <?xml version="1.0" encoding="UTF-8"?>
>  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <soapenv:Body>
>    <StockQuoteRequest
> xmlns="http://stockservice.contoso.com/wse/samples/2003/06">
>          <symbols>
>                  <Symbol>FABRIKAM</Symbol>
>                  <Symbol>CONSTOSO</Symbol>
>          </symbols>
>          <symbols1>
>                  <Symbol>CSCO</Symbol>
>                  <Symbol>JNPR</Symbol>
>          </symbols1>
>          <symbols2>
>                  <Symbol>ttt</Symbol>
>                  <Symbol>ppp</Symbol>
>          </symbols2>
>     </StockQuoteRequest>
>    </soapenv:Body>
>  </soapenv:Envelope>
>  
>  However, after I decrypt the message, I see that StockQuoteRequest element
> has additional namespaces which are 
>  not present in the original message before encrypting.
>   <StockQuoteRequest
> xmlns="http://stockservice.contoso.com/wse/samples/2003/06"
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>  <symbols>
>  <Symbol>FABRIKAM</Symbol>
>  <Symbol>CONSTOSO</Symbol>
>  </symbols>
>          <symbols1>
>  <Symbol>CSCO</Symbol>
>  <Symbol>JNPR</Symbol>
>  </symbols1>
>  <symbols2>
>  <Symbol>ttt</Symbol>
>  <Symbol>ppp</Symbol>
>  </symbols2>
>     </StockQuoteRequest>
>  
>  Any reason why the additional namespaces are getting added to
> StockQuoteRequest element?
>  Anyway I can retain the original message without having these namespaces
> getting added.
>  
>  Thanks,
>  Prakasa
>  


-- 
http://r-bg.com

Re: Namespace problem

Posted by Prakasa Nedunuri <pn...@cisco.com>.
Hi Vishal,
   Is there anyway I can bypass this problem?
Thanks,
Prakasa

At 02:40 PM 2/18/2005 +0530, Vishal Mahajan wrote:
>Hi Prakasa,
>
>This happens because the encryption code internally uses a 
>canonicalization-based serializer. During canonicalization the namespace 
>attributes are cascaded down the root node.
>
>Vishal
>
>Prakasa Nedunuri wrote:
>>Hi,
>>   I am trying to encrypt and decrypt SOAP body using xmlsec library.
>>Before encrypting, my original SOAP message is
>>
>><?xml version="1.0" encoding="UTF-8"?>
>><soapenv:Envelope 
>>xmlns:soapenv=<http://schemas.xmlsoap.org/soap/envelope/>"http://schemas.xmlsoap.org/soap/envelope/" 
>>xmlns:xsd=<http://www.w3.org/2001/XMLSchema>"http://www.w3.org/2001/XMLSchema" 
>>xmlns:xsi=<http://www.w3.org/2001/XMLSchema-instance>"http://www.w3.org/2001/XMLSchema-instance">
>>  <soapenv:Body>
>>   <StockQuoteRequest 
>> xmlns=<http://stockservice.contoso.com/wse/samples/2003/06>"http://stockservice.contoso.com/wse/samples/2003/06">
>>         <symbols>
>>                 <Symbol>FABRIKAM</Symbol>
>>                 <Symbol>CONSTOSO</Symbol>
>>         </symbols>
>>         <symbols1>
>>                 <Symbol>CSCO</Symbol>
>>                 <Symbol>JNPR</Symbol>
>>         </symbols1>
>>         <symbols2>
>>                 <Symbol>ttt</Symbol>
>>                 <Symbol>ppp</Symbol>
>>         </symbols2>
>>    </StockQuoteRequest>
>>   </soapenv:Body>
>></soapenv:Envelope>
>>
>>However, after I decrypt the message, I see that StockQuoteRequest 
>>element has additional namespaces which are
>>not present in the original message before encrypting.
>>  <StockQuoteRequest 
>> xmlns=<http://stockservice.contoso.com/wse/samples/2003/06>"http://stockservice.contoso.com/wse/samples/2003/06" 
>> xmlns:soapenv=<http://schemas.xmlsoap.org/soap/envelope/>"http://schemas.xmlsoap.org/soap/envelope/" 
>> xmlns:xenc=<http://www.w3.org/2001/04/xmlenc#>"http://www.w3.org/2001/04/xmlenc#" 
>> xmlns:xsd=<http://www.w3.org/2001/XMLSchema>"http://www.w3.org/2001/XMLSchema" 
>> xmlns:xsi=<http://www.w3.org/2001/XMLSchema-instance>"http://www.w3.org/2001/XMLSchema-instance">
>><symbols>
>><Symbol>FABRIKAM</Symbol>
>><Symbol>CONSTOSO</Symbol>
>></symbols>
>>         <symbols1>
>><Symbol>CSCO</Symbol>
>><Symbol>JNPR</Symbol>
>></symbols1>
>><symbols2>
>><Symbol>ttt</Symbol>
>><Symbol>ppp</Symbol>
>></symbols2>
>>    </StockQuoteRequest>
>>
>>Any reason why the additional namespaces are getting added to 
>>StockQuoteRequest element?
>>Anyway I can retain the original message without having these namespaces 
>>getting added.
>>
>>Thanks,
>>Prakasa


Re: Namespace problem

Posted by Vishal Mahajan <Vi...@Sun.COM>.
Hi Prakasa,

This happens because the encryption code internally uses a 
canonicalization-based serializer. During canonicalization the namespace 
attributes are cascaded down the root node.

Vishal

Prakasa Nedunuri wrote:

> Hi,
>   I am trying to encrypt and decrypt SOAP body using xmlsec library.
> Before encrypting, my original SOAP message is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>  <soapenv:Body>
>   <StockQuoteRequest 
> xmlns="http://stockservice.contoso.com/wse/samples/2003/06">
>         <symbols>
>                 <Symbol>FABRIKAM</Symbol>
>                 <Symbol>CONSTOSO</Symbol>
>         </symbols>
>         <symbols1>
>                 <Symbol>CSCO</Symbol>
>                 <Symbol>JNPR</Symbol>
>         </symbols1>
>         <symbols2>
>                 <Symbol>ttt</Symbol>
>                 <Symbol>ppp</Symbol>
>         </symbols2>
>    </StockQuoteRequest>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> However, after I decrypt the message, I see that StockQuoteRequest 
> element has additional namespaces which are
> not present in the original message before encrypting.
>  <StockQuoteRequest 
> xmlns="http://stockservice.contoso.com/wse/samples/2003/06" 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <symbols>
> <Symbol>FABRIKAM</Symbol>
> <Symbol>CONSTOSO</Symbol>
> </symbols>
>         <symbols1>
> <Symbol>CSCO</Symbol>
> <Symbol>JNPR</Symbol>
> </symbols1>
> <symbols2>
> <Symbol>ttt</Symbol>
> <Symbol>ppp</Symbol>
> </symbols2>
>    </StockQuoteRequest>
>
> Any reason why the additional namespaces are getting added to 
> StockQuoteRequest element?
> Anyway I can retain the original message without having these 
> namespaces getting added.
>
> Thanks,
> Prakasa