The "text" element is a locally defined element in your schema because it is declared as a child of the "sequence" element and not as a child of the "schema" element. The schema element has an attribute elementFormDefault whose default value is "unqualified". In your example, that attribute of the schema element is not shown so it assumes its default value of "unqualified".
This means that any locally declared elements are -not- in the targetNamespace but are instead not in any namespace. This is indicated by the xmlns="" attribute. The top level namespace should not "persist". If you want the text element to be in the targetNamespace, you should add an elementFormDefault="qualified" attribute to your schema element. Axis is doing the correct thing. Gary > -----Original Message----- > From: Chris Williamson [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2003 3:21 PM > To: [EMAIL PROTECTED] > Subject: namespace question > > > Hello, > > I have a question about namespaces while using document style > web service... > > Say I have a method defined by the schema... > > <schema > targetNamespace="http://www.domain.com/namespace" > xmlns="http://www.w3.org/2001/XMLSchema"> > <element name="operation"> > <complexType> > <sequence> > <element maxOccurs="1" name="text" type="xsd:string"/> > </sequence> > </complexType> > </element> > ... > </schema> > > It appears that the code that is generated by WSDL2Java > generates a message that would look something like this... > > <operation xmlns="http://www.domain.com/namespace"> > <text xmlns=""> > blah > </text> > </operation> > > Why does this add xmlns="" to the text element? Should this > not be there so that the top level namespace persists? > > I want to know this because I am of the opinion that the > namespace should persist to the elements defined inside the > element and you should be able to check against the namespace > of these elements on the server. With the client adding > xmlns="", the namespace is null and I can't check against the > namespace. Is it acceptable for the namespace to be null or > the namespace defined by targetNamespace? > > Thanks for any help, > > Chris >
