You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ji...@apache.org on 2004/03/27 19:25:05 UTC
[jira] Closed: (AXIS-1157) QName constants constructed without Schema-specified namespace
Message:
The following issue has been closed.
Resolver: Davanum Srinivas
Date: Sat, 27 Mar 2004 10:24 AM
Fixed.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/secure/ViewIssue.jspa?key=AXIS-1157
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXIS-1157
Summary: QName constants constructed without Schema-specified namespace
Type: Bug
Status: Closed
Resolution: FIXED
Project: Axis
Components:
WSDL processing
Fix Fors:
current (nightly)
Versions:
current (nightly)
Assignee:
Reporter: Alain Andrieux
Created: Wed, 10 Dec 2003 12:10 PM
Updated: Sat, 27 Mar 2004 10:24 AM
Environment: Operating System: Linux
Platform: PC
Description:
Overview Description:
---------------------
Problem:
Construction of QNames (in generated enumerated types, at least) is done by
merely passing the constant QName string value to the QName constructor, which
interprets it as a local name, consequently the namespace URI is empty ("").
Example:
given the Schema type UsageType a restriction of xsd:QName,
UsageType.java (wsp) constructs QName instances with String values
passed to the QName constructor as is ("<prefix>:<local name>")
instead of being parsed in order to extract the namespace URI (from
some mapping recorded by the in-memory Schema object model) and
the local name.
Example Input Schema
--------------------
<xs:simpleType name="UsageType">
[...]
<xs:restriction base="xs:QName">
<xs:enumeration value="wsp:Required"/>
<xs:enumeration value="wsp:Optional"/>
<xs:enumeration value="wsp:Rejected"/>
<xs:enumeration value="wsp:Ignored"/>
<xs:enumeration value="wsp:Observed"/>
</xs:restriction>
</xs:simpleType>
The full schema is at: http://schemas.xmlsoap.org/ws/2002/12/policy
Generated Java code:
--------------------
package org.xmlsoap.policy;
public class UsageType implements java.io.Serializable {
private javax.xml.namespace.QName _value_;
[...]
public static final javax.xml.namespace.QName _value1 = new
javax.xml.namespace.QName("wsp:Required");
public static final javax.xml.namespace.QName _value2 = new
javax.xml.namespace.QName("wsp:Optional");
[...]
public static UsageType fromString(java.lang.String value)
throws java.lang.IllegalStateException {
try {
return fromValue(new javax.xml.namespace.QName(value));
} catch (Exception e) {
throw new java.lang.IllegalStateException();
}
}
[...]
Consequences:
-------------
This will lead to run-time deserialization errors, for instance when the
prefix-to-namespace assignement is different in the XML document/payload
received than in the Schema used to generate the Java code on the
receiving side.
Also, for the same reasons, the fromString(String) static methods should be
deprecated in QName-based enumerated types in favor of methods like:
fromQName(QName) or from(String nsURI, String localName).
Proposal/Expected Behavior
--------------------------
The code generator should insert the namespace URI from the prefix read in the
QName value (in the schema) so that the generated code use it when constructing
the QName. As in:
new QName("http://schemas.xmlsoap.org/ws/2002/12/policy","Required");
instead of
new QName("wsp:Required");
Build Date:
-----------
I build source from a CVS check out made on 12/10/2003, around 2:00 am
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira