axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Andrade (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-4071) WSDL11ToAxisServiceBuilder + RPC/Literal OR HTTP binding =~ Inconsistent XMLSchema object: duplicated global element declarations
Date Fri, 17 Oct 2008 03:46:44 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Antonio Andrade updated AXIS2-4071:
-----------------------------------

    Attachment: AXIS2-4071.patch

Submitting patch. Ready for review:

It's very important to note that the duplication of global element declarations doesn't come
from the WSDLs themselves -i.e. the WSDL is perfectly valid- but from the fact that Axis2
converts other supported encoding styles into the Document/Literal encoding style using the
WRAPPED convention. This provides significant advantages, like data abstraction and consistent
processing of type definitions for different binding types but has some side effects (i.e.
this bug). The "fix" for this bug is not trivial; I think it's a trade-off so is important
to keep in mind what we gain/loose with the different approaches that can be taken.

I think that throwing an exception whenever a collision is detected have two important implications:
one technical and one conceptual, and may not be the best thing to do. Technically, it would
not be that simple -I think- since the collisions may occur at any level inside imported XML
schema documents (which may add more complexity to the code and harm performance); Conceptually,
there may not be a justification for failing to parse the WSDL model since the non-validity
of the XML schema documents comes from Axis2, not from the WSDL definition.

The attached patch is driven by the premise that 'internal data handling should not have any
side effect on any external data structure'.

a)  It's ok to create new elements but not within the original XML schema documents which
may be used/reused outside of the WSDL11ToAxisServiceBuilder class and that's why that part
of the code was removed in favor of always creating a separate XML schema document that can
isolate all 'internally' created elements.  Creating the new elements in different documents
(each for targetnamespace involved) doesn't solve the duplication problem but clearly separates
the original documents from the created ones.

b) As described in the bug's description, a namespace binding declaration (XMLNS_AXIS2WRAPPED)
was used to 'mark' these new schema documents. This is important because it can be used to
consistently identify the presence of new elements, which can be used to later determine if
an actual duplication problem exists or not. Previously, new elements could end up being inserted
into existing documents, which 1) is not ideal because of described above and 2) would add
additional complexity while finding duplicated elements declarations

c) Since the duplication problem still exists, the 'AxisService.getSchemaElement' method was
updated to start looking the element in the last-inserted schema document. This may be more
intuitive since elements declarations in the last schema document added would seem to ""overwrite""
previous ones.

d) Because in these type of global element element collisions nobody but the the client knows
which element is the "right" one to be used, clients interested in resolving the collisions
would need to remove/detach the conflicted schema document from the list of schema documents
saved into an AxisService object (i.e. getting the schema document list through the 'AxisService
.getSchema' method and detaching the conflicting schema. Note: original schema documents may
not be able to be removed due to possible dependencies between other imported documents and
the original document).

Again, I don't think any 'fix' for this bug would be trivial. I strongly feel that the patch
being submitted is the cleanest way to handle this but there may be things that I'm overlooking
so hopefully this will be reviewed and eventually committed into trunk.

> WSDL11ToAxisServiceBuilder + RPC/Literal OR HTTP binding =~ Inconsistent XMLSchema object:
duplicated global element declarations
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4071
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4071
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.4, nightly
>         Environment: Windows XP. 4GB RAM Intel Xeon dual-core @2.75Ghz
>            Reporter: Antonio Andrade
>         Attachments: AXIS2-4071.patch
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> In WSDL11ToAxisServiceBuilder:
>   1) Within the 'setup()' method, a map ('schemaMap') indexed by targetNamespace and
values equal root (W3C) Elements is populated
>   2) When either a RPC/Literal binding or an HTTP binding with message parts referencing
type definitions is found, new global element declarations based on the WSDL operation name
are created. These new elements can either be added to an existing (W3C) Document (in case
the 'schemMap'  contains a document with the same target namespace as the one that the newly
created element has) or added to a newly created Document.:
>     a) If a new document is created, an additional namespace mapping declaration is added
to that document (see 'XMLNS_AXIS2WRAPPED' ). This helps distinguishing this document among
the other original ones.
>     b) If an additional document is NOT created, the new global element declarations
are added to an existing document. No additional namespace mapping declaration is added.
>   3) After all wrapped elements have been created,  XmlSchema objects are created from
the original, modified and newly created W3C Documents
> Note that all this leads to duplicate global element declarations any time there's already
an element named after an operation name. This is very common and happens every time operation
names across multiple bindings are the same.  In general, all this is caused by the creation
of XML schema elements while transforming operations using the RPC/Literal encoding style
into the Document/Literal encoding style using the wrapped convention.
> There is more than one problem associated with the creation of new XML global element
declarations:
>   1) First of all, the XML schema documents end up with duplicated global element declarations
which makes the Schema invalid. But why nobody seems to have noticed it? I think it's just
a coincidence, let me explain: A XmlSchema object maintains a MAP, indexed by element name
(QName) and XmlSchemaElement objects as values. This map is used for a faster object retrieval.
At the same time, the XmlSchema object also maintains a LIST of all nodes (XmlSchemaObject
objects I think). So whenever duplicate elements are added to the schema, the last-inserted
elements overwrite the previous elements on the MAP of elements but they are inserted with
no problems in the LIST of nodes and because the latter elements are usually what people is
looking for (i.e. in case of databinding libraries that create the client stub for a single
port), the 'correct' element is returned
>   2) If the Definition object (from WSDL4J) is used to populate multiple AxisServices
from different WSDL ports, for example, within the 'WSDL11ToAllAxisServicesBuilder' (which,
by the way doesn't seem to work at all), the W3C Schema Document may end up with multiple
duplicated global element declarations and the 'AxisService.getSchemaElement(QName)' method
will fail to return the appropriate reference.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message