Index: src/main/org/codehaus/xfire/service/binding/ObjectServiceFactory.java =================================================================== --- src/main/org/codehaus/xfire/service/binding/ObjectServiceFactory.java (revision 1938) +++ src/main/org/codehaus/xfire/service/binding/ObjectServiceFactory.java (working copy) @@ -53,6 +53,7 @@ import org.codehaus.xfire.util.MethodComparator; import org.codehaus.xfire.util.NamespaceHelper; import org.codehaus.xfire.util.ServiceUtils; +import org.codehaus.xfire.wsdl.LocatorWSDL; import org.codehaus.xfire.wsdl11.DefinitionWSDL; import org.codehaus.xfire.wsdl11.builder.DefaultWSDLBuilderFactory; import org.codehaus.xfire.wsdl11.builder.WSDLBuilderAdapter; @@ -176,7 +177,7 @@ { return create(clazz, name, - WSDLFactory.newInstance().newWSDLReader().readWSDL(null, new InputSource(wsdlUrl.openStream())), + WSDLFactory.newInstance().newWSDLReader().readWSDL(new LocatorWSDL( null, new InputSource(wsdlUrl.openStream()))), properties); } catch (WSDLException e) Index: src/main/org/codehaus/xfire/wsdl/LocatorWSDL.java =================================================================== --- src/main/org/codehaus/xfire/wsdl/LocatorWSDL.java (revision 0) +++ src/main/org/codehaus/xfire/wsdl/LocatorWSDL.java (revision 0) @@ -0,0 +1,76 @@ +package org.codehaus.xfire.wsdl; + +import java.io.IOException; +import javax.wsdl.xml.WSDLLocator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.xfire.util.Resolver; +import org.xml.sax.InputSource; + +/** + * A WSDL resource locator. + * + * @author Daniel LaPrade + * + */ +public class LocatorWSDL implements WSDLLocator { + + private static final Log LOG = LogFactory.getLog( LocatorWSDL.class.getName() ); + + private String baseURI = ""; + private String lastimport = ""; + private InputSource inputsource = null; + + public LocatorWSDL( String baseURI, InputSource inputsource ) { + + this.inputsource = inputsource; + + if ( baseURI != null ) { + this.baseURI = baseURI; + } + } + + /* (non-Javadoc) + * @see javax.wsdl.xml.WSDLLocator#getBaseInputSource() + */ + public InputSource getBaseInputSource() { + return inputsource; + } + + /* (non-Javadoc) + * @see javax.wsdl.xml.WSDLLocator#getBaseURI() + */ + public String getBaseURI() { + return baseURI; + } + + /* (non-Javadoc) + * @see javax.wsdl.xml.WSDLLocator#getImportInputSource(java.lang.String, java.lang.String) + */ + public InputSource getImportInputSource( String arg0, String arg1 ) { + Resolver resolver; + InputSource result = null; + + // Set the last imported value. + lastimport = arg1; + + try { + resolver = new Resolver(baseURI, arg1); + + result = new InputSource( resolver.getInputStream() ); + } catch (IOException e) { + LOG.warn( "Source: " + arg1 + " failed to find input source with exception: " + e ); + } + + return result; + } + + /* (non-Javadoc) + * @see javax.wsdl.xml.WSDLLocator#getLatestImportURI() + */ + public String getLatestImportURI() { + return lastimport; + } + +}