Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: WSDL generation issue with import on WLS

  1. #11
    Join Date
    Feb 2006
    Location
    Hampshire
    Posts
    21

    Default

    Quote Originally Posted by Arjen Poutsma View Post
    This seems more a Commons XSD SChema bug, which doesn't seem to resolve files they way it should. We can try to fix this by writing our own org.apache.ws.commons.schema.resolver.URIResolver, and make it a bit more clever than the default.

    Flurdy, could you please create a JIRA issue for this?

    Thanks
    Someone else created a JIRA issue regarding this:
    http://jira.springframework.org/browse/SWS-362

  2. #12
    Join Date
    Feb 2006
    Location
    Hampshire
    Posts
    21

    Default

    JIRA issue 362
    http://jira.springframework.org/browse/SWS-362
    was opened by Oliver regarding this specific issue.

  3. #13
    Join Date
    Jun 2008
    Location
    Chicago
    Posts
    3

    Default

    This is still broken in 1.4.2.

    If Spring WS's CommonsXsdSchemaCollection could inject the XmlSchemaCollection. Then you could call setSchemaResolver() to use a custom URIResolver that was more intelligent.

  4. #14
    Join Date
    Jun 2008
    Location
    Chicago
    Posts
    3

    Default

    Here is my solution that seems to work. I am able to resolve schemeas loaded from both the file system and the classloader.

    import org.apache.ws.commons.schema.resolver.URIResolver;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.core.io.Resource;
    import org.springframework.core.io.UrlResource;
    import org.xml.sax.InputSource;

    public class DefaultUriResolver implements URIResolver {

    private final Logger logger = LoggerFactory.getLogger(DefaultUriResolver.class);

    /**
    * As for the resolver the publid ID is the target namespace of the
    * schema and the schemaLocation is the value of the schema location
    * @param namespace
    * @param schemaLocation
    * @param baseUri
    */
    public InputSource resolveEntity(String namespace,
    String schemaLocation,
    String baseUri){

    if (baseUri!=null)
    {
    try
    {
    logger.trace("namespace={}, schemaLocation={}, baseUri={}", new Object[] {namespace, schemaLocation, baseUri});

    UrlResource uri = new UrlResource(baseUri);
    Resource ref = uri.createRelative(schemaLocation);

    logger.trace("ref={}", ref);

    return new InputSource(ref.getURI().toString());
    }
    catch (Exception ex)
    {
    logger.warn("Invalid URI", ex);
    throw new RuntimeException(ex);
    }

    }
    return new InputSource(schemaLocation);
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •