Hello Ajith, thank you for responding =) WSDL4J picks up the relative path just fine. The problem is that a relative file path in a application server environment is not predictable.
Consider this (I use tomcat as example): If I start Tomcat from c:\tomcat\bin and then in a servlet (located in say "c:\tomcat\webapps\axis2") execute the code "new File("../schemas/someschema.xsd").toURL();" I will get "file:/C:/tomcat/bin/../schemas/someschema.xsd" Looking at the WSDL4J source (not sure if I'm looking at the right version though) and judging by the error message I get it seems that this is what happens when Axis2 parses my wsdl. As the base URI in this case is not predictable (depends on the servlet container/application server and how it is started) I have no chance to place the schemas in a location that they will get picked up by WSDL4J unless I can somehow specify this location. The relative path must work both for WSDL4J parsing the wsdl server-side in Axis2 and publicly for a consumer of my webservice (relative to the ?wsdl url). I would not mind having to duplicate the schema files (two locations) as long as they are all located inside my webapp folders. Perhaps this could be solved by axis2 specifying a base URI for relative imports? Best Regards, Johan Andersson -----Original Message----- From: "Ajith Ranabahu" <[EMAIL PROTECTED]> To: axis-user@ws.apache.org Date: Wed, 1 Mar 2006 02:47:54 -0600 Subject: Re: [axis2] WSDL and XML Schema Imports Hi, Hmmm.. WSDL4J has a method that allows it to use a given base uri but I'm not sure whether this is the problem. I mean wsdl4j is perfectly capable of picking up schemas from relative uri's. I'll try to test this scenario in a test case and let you know. Ajith On 3/1/06, Johan Andersson <[EMAIL PROTECTED]> wrote: > Ajith: > > Yes, it seems that WSDL4J is used to parse the wsdl serverside after I have > deployed my service. > > The exception originates from: > com.ibm.wsdl.util.StringUtils.getContentAsInputStream > > If I could register a EntityResolver or simply specify a directory where > WSDL4J should look for the imported schemas so I could use a relative > schemaLocation it would solve my problem. > > Yet another possible solution would be for Axis2 to give me a chance to > modify the WSDL on the fly _before_ parsing it serverside. > > Ali: The problem is that the host is not known when I write or rather > generate my wsdl so I cannot include the hostname in the schemaLocation so no > complete URL is possible. > > Best Regards, > Johan Andersson > > > > -----Original Message----- > From: "Ajith Ranabahu" <[EMAIL PROTECTED]> > To: axis-user@ws.apache.org > Date: Tue, 28 Feb 2006 22:12:54 -0600 > Subject: Re: [axis2] WSDL and XML Schema Imports > > Hi, > does the error pop up from WSDL4J ? > > On 2/28/06, Ali Sadik Kumlali <[EMAIL PROTECTED]> wrote: > > Hi Johan, > > > > I am not sure if it's a solution to your problem but I use real URL in > > schemaLocation to get rid of this kind of problems. What I do is defining my > > target URL in hosts file that maps to localhost. And also, I use Apache Web > > Server or IIS to host the localhost. For example, assuming you need to make > > following definition: > > > > schemaLocation="http://my.company.com/schemas/myschema.xsd" > > > > I offer you to do the following: > > > > 1) Add an entry to the "hosts" file: > > > > my.company.com localhost > > > > "hosts" file resides under > > c:\WINDOWS\system32\drivers\etc\ in my Windows XP > > > > 2) Install Apache Web Server or IIS. I use Apache. > > > > 3) Create the "schemas" folder under htdocs folder of Apache. IIS must have > > its own directory structure. > > > > 4) Put the "myschema.xsd" file under "schemas" folder > > > > 5) When you call > > http://my.company.com/schemas/myschema.xsd URL with your > > browser, it must be there! > > > > Good luck, > > > > Ali Sadik Kumlali > > > > > > Johan Andersson <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I'm struggling with schema imports in my wsdl files and would like some > > hints for how to proceed. > > > > The hostname of the target web server/servlet container is not known at the > > time I create my wsdl so I am trying to use a relative schemaLocation > > in my import: > > <xsd:import namespace="http://my.domain.com/common/stuff" > > schemaLocation="../schemas/myschema.xsd" /> > > > > When I deploy my service, Axis2 will parse this wsdl and try to resolve the > > location of the schema as a file and fail because the "current directory" is > > not anywhere near the webapp folder. > > > > If I give the full URL to the imported schema > > (http://myhost:port/axis2/schemas/myschema.xsd) it works > > like a charm but as I said the hostname is not known at the time I create > > the wsdl so this is not an option. > > > > Is there any way to hook in an Entity Resolver, set some kind of property to > > get the wsdl4j to load schemas of the classpath or even disabling parsing of > > the wsdl:types so I can get this to work please let me know. > > > > Best Regards > > Johan Andersson > > > > > > > > > > ________________________________ > > Yahoo! Mail > > Bring photos to life! New PhotoMail makes sharing a breeze. > > > > > > > -- > Ajith Ranabahu > > > > -- Ajith Ranabahu