This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes addition of namespace to every element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "addition of namespace to every element" Watch "addition of namespace to every element" New topic
Author

addition of namespace to every element

chaitu sravs
Greenhorn

Joined: Oct 21, 2009
Posts: 11
Hi,

SOAPFactory that is shipped with JDK1.6.x seems to add the prefix:namspace declaration to each child element in the soap envelope, for the actual elements of the payload. The namespace is declared at the envelope level and I thought just a prefix needs to be added to the actual usage of the elements.

Yes, this is not posing any problems, however, just got curious because even when those attributes are removed, the message still successfuly gets processed-

any hints on how to disable it?

Thanks,
Chinni
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Make sure that the attribute elementFormDefault is not set to "qualified" in the XML schema declaration for the payload.
The default value is "unqualified" (no elementFormDefault attribute is present).
If you do code-first development, you will want to use the @XmlSchema annotation on the packet level. Example from the API documentation:
@javax.xml.bind.annotation.XmlSchema (
elementFormDefault=XmlNsForm.UNQUALIFIED
...
)

<!-- XML Schema fragment -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
elementFormDefault="unqualified">

If this is not the cause of the "problem", then I do not know what it may be.
Best wishes!
 
 
subject: addition of namespace to every element
 
Similar Threads
SOAP doubt: The Envelope element
Fault Query
SOAP doubts
Mock exam question: SOAP doubt
When the default namespace is an empty string?