[
https://issues.apache.org/jira/browse/WODEN-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586953#action_12586953
]
Lawrence Mandel commented on WODEN-204:
---------------------------------------
Keith, I started digging a little deeper for AXIS2-3717 and think I realized
what your actual problem is. You cannot access the schema elements in the WSDL
model produced by using Woden. The reason for this is your WSDL violates schema
access rules. Woden doesn't produce an error because the relevant WSDL
assertion hasn't been implemented yet.
The problem lies in the way in which you're importing the schema.
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://charitha.org">
<xsd:import namespace="http://charitha.org/"
schemaLocation="calculatorImportSchema?xsd=xsd0.xsd"/>
</xsd:schema>
Although this is the WS-I recommended way to import a schema into WSDL 1.1
schemas imported within inline schemas are not visible to the WSDL document. To
import a schema in a WSDL 2.0 document a schema import element must appear as a
child of the WSDL types as element [1] as follows:
<wsdl2:types>
<xsd:import namespace="http://charitha.org/"
schemaLocation="calculatorImportSchema?xsd=xsd0.xsd" />
</wsdl2:types>
[1] http://www.w3.org/TR/2007/REC-wsdl20-20070626/#xsd-types
> Schema resolving issue in Axis2
> -------------------------------
>
> Key: WODEN-204
> URL: https://issues.apache.org/jira/browse/WODEN-204
> Project: Woden
> Issue Type: Test
> Components: Parser
> Affects Versions: M7b
> Reporter: Keith Godwin Chapman
> Assignee: Lawrence Mandel
> Attachments: calculatorImportSchema.wsdl, calculatorImportSchema.xsd,
> Test.java
>
>
> Hi all,
> This is regarding http://issues.apache.org/jira/browse/AXIS2-3379. I
> have attached both the WSDL and the schema for this scenario. The WSDL
> is available at
> http://localhost:8080/axis2/services/calculatorImportSchema?wsdl2 and
> the schema is available at
> http://localhost:8080/axis2/services/calculatorImportSchema?xsd=xsd0.xsd.
> It looks like a problems occurs because the schema import. I set
> http://localhost:8080/axis2/services/calculatorImportSchema?wsdl2 as the
> baseURI hence this should resolve to the correct schemaLocation where
> the schema is located at. However I do get an error when I try to
> perform the following operation, here messageReference is an
> InterfaceMessageReference.
> String messageContentModelName = messageReference.getMessageCont
> entModel();
> QName elementQName = null;
> if
> (WSDL2Constants.NMTOKEN_ELEMENT.equals(messageContentModelName)) {
> ElementDeclaration elementDeclaration =
> messageReference.getElementDeclaration();
> if (elementDeclaration == null) {
> InterfaceMessageReferenceElement messageReferenceElement =
> messageReference.toElement();
> QName qName =
> messageReferenceElement.getElement().getQName();
> throw new AxisFault("Unable to find element " +
> qName.toString() + " reffered to by operation " +
> axisOperation.getName().getLocalPart());
> }
> elementQName = elementDeclaration.getName();
> } else if
> (WSDL2Constants.NMTOKEN_ANY.equals(messageContentModelName)) {
> elementQName = Constants.XSD_ANY;
> }
> When the above is performed I get a AxisFault because the
> elementDeclaration is null. And Axis2 fails saying
> org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Unable to find
> element {http://charitha.org/}addition reffered to by operation addition
> This is clearly a problem with schema resolving. I'm not sure weather
> this is a woden bug or an issue in the way axis2 reads the WSDL. Here is
> the code we use to read the WSDL,
> private Description readInTheWSDLFile(String wsdlURI) throws
> WSDLException, AxisFault {
> DocumentBuilderFactory documentBuilderFactory =
> DocumentBuilderFactory
> .newInstance();
> documentBuilderFactory.setNamespaceAware(true);
> DocumentBuilder documentBuilder;
> Document document;
> try {
> documentBuilder = documentBuilderFactory.newDocumentBuilder();
> document = documentBuilder.parse(wsdlURI);
> } catch (ParserConfigurationException e) {
> throw AxisFault.makeFault(e);
> } catch (IOException e) {
> throw AxisFault.makeFault(e);
> } catch (SAXException e) {
> throw AxisFault.makeFault(e);
> }
> return readInTheWSDLFile(document);
> }
> private Description readInTheWSDLFile(Document document) throws
> WSDLException {
> WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
> if (customWSDLResolver != null) {
> reader.setURIResolver(customWSDLResolver);
> }
> // This turns on WSDL validation which is set off by default.
> reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
> WSDLSource wsdlSource = reader.createWSDLSource();
> wsdlSource.setSource(document.getDocumentElement());
> if (getBaseUri() != null && !"".equals(getBaseUri())) {
> try {
> wsdlSource.setBaseURI(new URI(getBaseUri()));
> } catch (URISyntaxException e) {
> AxisFault.makeFault(e);
> }
> }
> if (log.isDebugEnabled()) {
> log.debug("Reading 2.0 WSDL with wsdl uri = " + wsdlURI);
> log.debug(" the stack at this point is: " + stackToString());
> }
> return reader.readWSDL(wsdlSource);
> }
> Your help in this regard is appreciated.
> Thanks,
> Keith.
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]