[ 
http://issues.apache.org/jira/browse/AXISCPP-573?page=comments#action_12312843 
] 

Dushshantha Chandradasa commented on AXISCPP-573:
-------------------------------------------------

Here the problem is that the method setURI (const AxisChar* uri) just set a 
string variable. The engine uses the prifix which is also a string variable in 
the Attribute object to get the namespace declaration. If we call the 
setURI(const AxisChar* uri) method while there is a prevously set  prefix, it 
only changes m_uri string variable in the Attribute object which is the return 
value of getURI() method. Engine still uses the namespace prefix to get the 
namespace declaration. 

I think , removing the setURI() from the API list is not a good idea as one 
need to set the URI when the prifix is empty. 

Among the other two options, the best one is option 1. Here if there is a 
previously set prefix, setURI() shoul dautomatically set the prefix 
accordingly. And there is no predefined namespace with that URI, the prefix 
should be set to empty.

Any thoughts on this???

> problem in setURI() API in IAttribute class
> -------------------------------------------
>
>          Key: AXISCPP-573
>          URL: http://issues.apache.org/jira/browse/AXISCPP-573
>      Project: Axis-C++
>         Type: Bug
>   Components: Client - Engine
>     Reporter: James Jose
>     Assignee: Dushshantha Chandradasa

>
> If the prefix of the attribute is empty and if I use setURI() then the 
> Attribute class correctly serialize by adding the correct prefix and if 
> necessary will even add the namespace declaration to the serialized output.
> IAttribute *attr1=phb->createAttribute("Name","","axis");
> attr1->setURI("http://axis.apache.com";);
> will create the following soap message
> <ns:TestHeader xmlns:ns="http://ws.apache.org/"; 
> xmlns:ns2="http://axis.apache.com"; ns2:Name="axis">
> Here setURI() results in generating a namespace declaration for the uri 
> "http://axis.apache.com"; and used the generated prefix 'ns2' as the prefix 
> for 'Name' attribute.
>  But if the attribute prefix is not empty, then this setURI() does not change 
> its prefix.
> INamespace *nsp=phb->createNamespaceDecl ("nsp","http://apache.com";);
> IAttribute *attr1=phb->createAttribute("Name","nsp","axis");
> attr1->setURI("http://axis.apache.com";);
> results in 
> <ns:TestHeader xmlns:ns="http://ws.apache.org/"; nsp:Name="axis" 
> xmlns:nsp="http://apache.com";>
> attr1->getPrefix() will return 'nsp'
> attr1->getURI() will return 'http://axis.apache.com'
> but there is no namespace declaration for this combination.
> So either
>  1.setURI() should also change the prefix value accordingly.
>  2.setURI() should not change the URI if prefix is already set.
>  3.setURI() should be removed from the API list.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to