Created a Jira https://issues.apache.org/jira/browse/WODEN-204
Thanks, Keith. On Thu, Apr 3, 2008 at 8:33 AM, Lawrence Mandel <[EMAIL PROTECTED]> wrote: > Hi Keith, > > Can you open a Jira for this issue? I'll see if I can find some time to > debug before the end of the week. > > Thanks, > > Lawrence > > > > > > Keith <[EMAIL PROTECTED]> > 04/02/2008 10:39 PM > Please respond to > [email protected] > > > To > [email protected] > cc > > Subject > Schema resolving issue in Axis2 > > > > > > > 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 > <http://charitha.org/%7Daddition>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. > > Keith Chapman > Software Engineer > WSO2 Inc. > Oxygenating the Web Service Platform. > http://wso2.org/ > > blog: http://www.keith-chapman.org > <wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl" xmlns:tns=" > http://charitha.org/" xmlns:wsoap="http://www.w3.org/ns/wsdl/soap" > xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc" xmlns:ns0="http://charitha.org" > xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdlx=" > http://www.w3.org/ns/wsdl-extensions" xmlns:xsd=" > http://www.w3.org/2001/XMLSchema" xmlns:soap=" > http://schemas.xmlsoap.org/wsdl/soap/" xmlns:whttp=" > http://www.w3.org/ns/wsdl/http" xmlns:wsdl=" > http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://charitha.org/ > "><wsdl2:documentation>This is a sample wsdl for testing contract first > approach</wsdl2:documentation><wsdl2:types><xsd:schema > attributeFormDefault="unqualified" elementFormDefault="unqualified" > targetNamespace="http://charitha.org"> > <xsd:import namespace="http://charitha.org/" > schemaLocation="calculatorImportSchema?xsd=xsd0.xsd"/> > </xsd:schema></wsdl2:types><wsdl2:interface > name="calculatorportType"><wsdl2:operation name="addition" style=" > http://www.w3.org/ns/wsdl/style/rpc http://www.w3.org/ns/wsdl/style/iri > http://www.w3.org/ns/wsdl/style/multipart" wrpc:signature="x #in y #in > addreturn #return " pattern="http://www.w3.org/ns/wsdl/in-out > "><wsdl2:input element="tns:addition" > wsaw:Action="urn:addition"/><wsdl2:output element="tns:additionResponse" > wsaw:Action="http://charitha.org/calculatorportType/additionResponse > "/></wsdl2:operation><wsdl2:operation name="multiplication" style=" > http://www.w3.org/ns/wsdl/style/rpc http://www.w3.org/ns/wsdl/style/iri > http://www.w3.org/ns/wsdl/style/multipart" wrpc:signature="a #in b #in > multiplyreturn #return " pattern="http://www.w3.org/ns/wsdl/in-out > "><wsdl2:input element="tns:multiplication" > wsaw:Action="urn:multiplication"/><wsdl2:output > element="tns:multiplicationResponse" wsaw:Action=" > http://charitha.org/calculatorportType/multiplicationResponse > "/></wsdl2:operati > on><wsdl2:operation name="division" style=" > http://www.w3.org/ns/wsdl/style/rpc http://www.w3.org/ns/wsdl/style/iri > http://www.w3.org/ns/wsdl/style/multipart" wrpc:signature="k #in l #in > divreturn #return " pattern="http://www.w3.org/ns/wsdl/in-out > "><wsdl2:input element="tns:division" > wsaw:Action="urn:division"/><wsdl2:output element="tns:divisionResponse" > wsaw:Action="http://charitha.org/calculatorportType/divisionResponse > "/></wsdl2:operation></wsdl2:interface><wsdl2:binding > name="calculatorSOAP" interface="tns:calculatorportType" type=" > http://www.w3.org/ns/wsdl/soap" wsoap:version="1.1"><wsdl2:operation > ref="tns:addition" wsoap:action="urn:addition"/><wsdl2:operation > ref="tns:multiplication" > wsoap:action="urn:multiplication"/><wsdl2:operation ref="tns:division" > wsoap:action="urn:division"/></wsdl2:binding><wsdl2:service > name="calculatorImportSchema" > interface="tns:calculatorportType"><wsdl2:endpoint > name="calculatorSOAP11_http" binding="tns:calculatorSOAP" > address="http://l > > > ocalhost:9762/services/calculatorImportSchema"/></wsdl2:service></wsdl2:description><xsd:schema > xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns=" > http://charitha.org/" attributeFormDefault="unqualified" > elementFormDefault="qualified" targetNamespace="http://charitha.org/"> > <xsd:element name="division"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="k" type="xsd:double"/> > <xsd:element name="l" type="xsd:double"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="divisionResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="divreturn" type="xsd:double"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="addition"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="x" type="xsd:int"/> > <xsd:element name="y" type="xsd:int"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="additionResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="addreturn" type="xsd:int"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="multiplication"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="a" type="xsd:int"/> > <xsd:element name="b" type="xsd:int"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="multiplicationResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="multiplyreturn" type="xsd:int"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Keith Chapman Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org
