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 "Dobri Kitipov (JIRA)" <ji...@apache.org> on 2008/10/06 09:27:44 UTC

[jira] Issue Comment Edited: (AXIS2-1790) schemaLocation element of import statements should contain URI reference to schema document.

    [ https://issues.apache.org/jira/browse/AXIS2-1790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637023#action_12637023 ] 

dobri edited comment on AXIS2-1790 at 10/6/08 12:27 AM:
----------------------------------------------------------------

Hi Amila,
It seems that the fix you have applied into the trunk is ok, but needs a little fix related to import of XSDs. I did some tests and found out that the fix is not complete when you request xsd with "...?xsd".
The problem is that if GENERATE_ABSOLUTE_LOCATION_URIS is set to "true" and you import an xsd that in turn imports another external xsd then the latter has relative path again.

You can test this with the AAR attached to the current JIRA (i.e. XsdAndWsdlImportTestService.aar). Rrequest http://<YOUR_HOST>/axis2/services/MultiDimentionalArrayInteropTestService?xsd=xsd0.xsd and you will see the following:

<xs:import namespace="http://jaxb.dev.java.net/array" schemaLocation="MultiDimentionalArrayInteropTestService?xsd=xsd1.xsd"/>

instead of schemaLocation with absolute path set:

<xs:import namespace="http://jaxb.dev.java.net/array" schemaLocation="http://<YOUR_HOST>/axis2/services/MultiDimentionalArrayInteropTestService?xsd=xsd1.xsd"/>

The problem was caused by the AxisService private void adjustSchemaLocation(...) method.

I am applying a patch for this, but the patch removes and the not thrown cached AxisFault exception from private String getServiceEPR() method. 

Thank you,

      was (Author: dobri):
    Hi Amila,
It seems that the fix you have applied into the trunk is ok, but is missing a little part of work. I did some tests and found out that the fix is not complete when you request xsd with "...?xsd".
The problem is that if GENERATE_ABSOLUTE_LOCATION_URIS is set to "true" and you import an xsd that in turn imports another external xsd then the latter has relative path again.

You can test this with the AAR attached to the current JIRA (i.e. XsdAndWsdlImportTestService.aar). Rrequest http://<YOUR_HOST>/axis2/services/MultiDimentionalArrayInteropTestService?xsd=xsd0.xsd and you will see the following:

<xs:import namespace="http://jaxb.dev.java.net/array" schemaLocation="MultiDimentionalArrayInteropTestService?xsd=xsd1.xsd"/>

instead of schemaLocation with absolute path set:

<xs:import namespace="http://jaxb.dev.java.net/array" schemaLocation="http://<YOUR_HOST>/axis2/services/MultiDimentionalArrayInteropTestService?xsd=xsd1.xsd"/>

The problem was caused by the AxisService private void adjustSchemaLocation(...) method.

I am applying a patch for this, but the patch removes and the not thrown cached AxisFault exception from private String getServiceEPR() method. 

Thank you,
  
> schemaLocation element of import statements should contain URI reference to schema document.
> --------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-1790
>                 URL: https://issues.apache.org/jira/browse/AXIS2-1790
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: wsdl
>    Affects Versions: 1.1
>         Environment: Windows XP, Java 5 Update 9
>            Reporter: Aaron Gourley
>            Assignee: Deepal Jayasinghe
>         Attachments: axis2-kernel-SNAPSHOT.jar, AxisService.patch, schema-import-generation.patch, XsdAndWsdlImportTestService.aar
>
>
> From W3C schemaLocation spec: http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/structures.html#composition-schemaImport
> Additional reference: http://www.stylusstudio.com/w3c/schema0/schemaLocation.htm#attribute-schemaLocation
> <import
>   id = ID
>   namespace = anyURI
>   schemaLocation = anyURI
>   {any attributes with non-schema namespace . . .}>
>   Content: (annotation?)
> </import>
> "In a schema, the  include element has a required schemaLocation  attribute, and it contains a URI reference which must identify a schema document."
> Axis2 is currently using a relative SchemaLocation, which on its own can not be used to identify the schema document.  This actually causes a compatibility problem between Glue clients and such WSDLs published by Axis2.
> WSDL published by Axis2:
> <wsdl:definitions targetNamespace="http://www.csapi.org/wsdl/parlayx/terminal_location/v2_0/service">
> <wsdl:documentation>TerminalLocation</wsdl:documentation>
>     <wsdl:types>
>         <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.csapi.org/schema/parlayx/terminal_location/v2_0/local">
>             <xsd:import namespace="http://www.csapi.org/schema/parlayx/terminal_location/v2_0" schemaLocation="TerminalLocation?xsd=xsd0"/>
>             <xsd:import namespace="http://www.csapi.org/schema/parlayx/common/v2_0" schemaLocation="TerminalLocation?xsd=xsd2"/>
>      .....
>     <wsdl:service name="TerminalLocation">
>         <wsdl:port name="TerminalLocationSOAP11port_http" binding="tns:TerminalLocationSOAP11Binding">
>             <soap:address location="http://localhost:9080/TerminalLocationService/services/TerminalLocation"/>
>         </wsdl:port>
>         <wsdl:port name="TerminalLocationSOAP12port_http" binding="tns:TerminalLocationSOAP12Binding">
>             <soap12:address location="http://localhost:9080/TerminalLocationService/services/TerminalLocation"/>
>         </wsdl:port>
>         <wsdl:port name="TerminalLocationHttpport1" binding="tns:TerminalLocationHttpBinding">
>             <http:address location="http://localhost:9080/TerminalLocationService/rest/TerminalLocation"/>
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>
> When Glue parses this WSDL, it simply creates a URI from the string "TerminalLocation?xsd=xsd0".  Since the prefix ("http://localhost:9080/TerminalLocationService/services/") is not shown in the WSDL, a FileNotFoundException occurs and the bind fails.  I have not been able to find a workaround using Glue.
> I realize that the easy solution is to say that this is a Glue problem, but would it be at all possible to include the address location in the generated WSDL?
> Suggested fix:
> 1. In AxisService's adjustSchemaLocation(XmlSchema, XmlSchemaExternal, Hashtable, Hashtable) method:
>     - Change getName() in default mode to getEndpoint()
> 2. In AxisService2WSDL2's generateOM() method:
>     - add call to axisService.setCustomSchemaNamePrefix(axisService.getEndpoint() + "?xsd=") before call to populateSchemaMappings() is made.

-- 
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