[ 
https://issues.apache.org/jira/browse/WODEN-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586940#action_12586940
 ] 

Lawrence Mandel commented on WODEN-204:
---------------------------------------

Keith,

After running some tests this doesn't seem to be a Woden problem.

I created the class below (I will attach the class as well) which uses the same 
logic as the methods you provided above. I removed the Axis2 specific calls to 
get this to compile. I also removed the call to getBaseUri as I don't know how 
this is set and instead set the base URI explicitly. With this configuration I 
see one Woden warning
Woden[Warning],0:0,Description-1001,The targetNamespace 'http://charitha.org/' 
is not dereferencable.
which is expected and can be ignored.

I also tested without setting the base URI on the wsdlSource. If I do not set 
the base URI on the wsdlSource I get the following error:
Woden[Error],0:0,WSDL521,Could not parse an inline schema in the WSDL at URL 
"null".,java.lang.RuntimeException:java.lang.NullPointerException
This error may be the same error you are getting only in your case the error is 
wrapped by Axis2. Is is possible that that getBaseUri() method is returning 
null or "" in this case causing the base URI not to be set on the wsdlSource?

package org.apache.woden;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.woden.internal.DOMWSDLFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class Test {
public static void main(String[] args) throws WSDLException {

DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder;
Document document = null;

try {
documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder
.parse("http://localhost:8080/testResolution/calculatorImportSchema?wsdl";);
} catch (ParserConfigurationException e) {
System.out.println(e);
} catch (IOException e) {
System.out.println(e);
} catch (SAXException e) {
System.out.println(e);

}

WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();

// 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(
"http://localhost:8080/testResolution/calculatorImportSchema?wsdl";));
} catch (URISyntaxException e) {
System.out.println(e);
}
// }

reader.readWSDL(wsdlSource);

}
}

> Schema resolving issue in Axis2
> -------------------------------
>
>                 Key: WODEN-204
>                 URL: https://issues.apache.org/jira/browse/WODEN-204
>             Project: Woden
>          Issue Type: Test
>            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]

Reply via email to