You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kai Unewisse <ka...@innovations.de> on 2003/06/25 11:25:17 UTC

problem creating a XML namespace with a given Prefix

Hi,
I have a problem creating a XML namespace with a given Prefix (wsu):


My Code :
  soapBody.addNamespaceDeclaration("wsu",
"http://schemas.xmlsoap.org/ws/2002/07/utility");

  PrefixedQName qname = new PrefixedQName(
"http://schemas.xmlsoap.org/ws/2002/07/utility", "Id", "wsu");
  soapBody.addAttribute(qname ,attr.item(i).getNodeValue() );

The Result :
  <soapenv:Body ns1:Id="wsse-1a2c3870-a6eb-11d7-8103-61f316cc9325"
xmlns:ns1="http://schemas.xmlsoap.org/ws/2002/07/utility">

------------------------------------------
When I use :
  soapEnvelope.addMapping(new
Mapping("http://schemas.xmlsoap.org/ws/2002/07/utility", "wsu"));

  PrefixedQName qname = new PrefixedQName(
"http://schemas.xmlsoap.org/ws/2002/07/utility", "Id", "wsu");
  soapBody.addAttribute(qname ,attr.item(i).getNodeValue() );

is the result OK:
  <soapenv:Envelope (...)
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">

 <soapenv:Body wsu:Id="wsse-67dabc80-a6ec-11d7-98fa-71b2b9a5154e">


Do I need additional steps to addNamespaceDeclaration(), when I want to add
a Namespace Declaration ? Is there a easier way ?

Please forgive me asking such easy questions, but I couldn't find anything
in the archive and the Bug report.


Thanks for your help,

Kai