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

Ben Reif commented on AXIS2-4353:
---------------------------------

I've attached an Eclipse project with a simple test case. Inside the project 
there is a Jar file called core-webservices-consumer.jar that is in the 
Classpath. This is where the wfxml-bpm.wsdl file is, which imports some *.xsd 
files and those also import other *.xsd files.

I've seen other defects related to this. I think the root of the issue is in 
the DefaultURIResolver class from the ws-commons project, where it does this:

String ref = new URI(baseUri).resolve(new URI(schemaLocation)).toString();

In the test case the baseUri is 
'jar:file:/C:/eclipseWorkspace/ResolveXSDTestCase/lib/core-webservices-consumer.jar!/assignmentEngine/wsdl/'
 and the schemaLocation is 'wfxml20-bpm.xsd'.

Since the baseUri starts with 'jar:file:', it's opaque, so the call to the 
resolve method just returns the original value of schemaLocation, which is the 
incorrect value of 'ref'. This causes it to create the InputSource with a 
system ID of 'wfxml20-bpm.xsd' instead of the fully qualified path. 

Ideally, the best solution would be to fix the DefaultURIResolver, but another 
short term option might be to expose a URIResolver argument on the 
ServiceClient constructors and the AxisService.createClientSideAxisService() 
methods, which could then call 
WSDL11ToAxisServiceBuilder.setCustomResolver(URIResolver customResolver) . That 
way I could implement my own URIResolver and pass it in.

> ServiceClient can not resolve WSDL with imported schemas
> --------------------------------------------------------
>
>                 Key: AXIS2-4353
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4353
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1, 1.4
>         Environment: all
>            Reporter: Ben Reif
>            Priority: Blocker
>
> I am using the ServiceClient to invoke a Web Service, but the WSDL file and 
> imported schema files are located within a jar file that is in the Classpth. 
> I can get the Definition object, and I set the DocumentBaseURI to the proper 
> URL pointing inside the jar file, but when I pass it to the ServiceClient I 
> get an error saying that it can't resolve the imported schema files. This 
> happens when it calls AxisService.createClientSideAxisService().
> It looks like a fix was put in the WSDLToAxisServiceBuilder class (the 
> addition of the setCustomResolver() method) so that you can set a custom 
> URIResolver to resolve imported schema files. This gets inherited by the 
> WSDL11ToAxisServiceBuilder, however the problem is that this setter is not 
> exposed to the ServiceClient, so I can never use it.  The ServiceClient 
> constructors and the AxisService.createClientSideAxisService() methods should 
> take in an additional argument so that calling code can pass in the right 
> URIResolver instance which would get set on the WSDL11ToAxisServiceBuilder 
> instance.

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

Reply via email to