Hello Keith,
Thanks for reply. I have implemented URIResolver but i
am still getting ConnectException. Here is complete
code i have written:

In schemaLocation='HP_CI_utility_Schema_ver1'.

In MyURIResolver:

public URILocation resolve(String href, String
 documentBase)
          throws URIException
      {
          // create a reader or inputstream for
 resource
          URL url = new
 URL("http//localhost:7001/MyServlet?fileName=" +
href)

href = "http//localhost:7001/MyServlet?fileName=" +
href;//I change it af href contains only
HP_CI_utility_Schema_ver1, is it correct?, without
changing it castor looks into local file system.

URILocation uril = new 
 URILocationImpl(url.openStream(), href);

/*uril.toString() prints
http//localhost:7001/MyServlet?fileName=HP_CI_utility_Schema_ver1*/
/*http//localhost:7001/MyServlet?fileName=HP_CI_utility_Schema_ver1
can be accessed directly from browser*/

          return uril ;
      }

While reading Schema:
      SchemaReader schemaReader = new
SchemaReader(inputSource);
      schemaReader.setValidation(false);
      schemaReader.setURIResolver(new
MyURIResolver());
Schema schema = schemaReader.read();

When i run the program, i still get the same
ConnectException:

Error reading import file
'http//localhost:7001/MyServlet?fileName=HP_CI_utility_Schema_ver1':
java.net.ConnectException: Connection refused: connect
        at
org.exolab.castor.xml.schema.reader.ImportUnmarshaller.<init>(ImportUnmarshaller.java:199)
        at
org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUnmarshaller.java:523)
        at
org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2ComponentReader.java:253)
        at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)....some more


Please guide me about solving this problem, we are
facing this problem from long time. Is there
anysetting required? Does castor uses
java.net.URLConnection internally or
SOAPHttpConnection? 


Thanks a lot in advance,
Deepak

--- Keith Visco <[EMAIL PROTECTED]> wrote:

> Deepak,
> 
> You need to implement URIResolver.
> 
> The InputStream and Reader arguments allow you to
> provide the URILocationImpl 
> with the way in which to read the URI. So for
> example, in your URIResolver class 
> you can do something like the following:
> 
>      public URILocation resolve(String href, String
> documentBase)
>          throws URIException
>      {
>          // create a reader or inputstream for
> resource
>          URL url = new
> URL("http//localhost:7001/MyServlet?" + href)
>          return new 
> URILocationImpl(url.openStream(), href);
>      }
> 
> HTH,
> 
> --Keith
> 
> 
> Deepak wrote:
> > Dear All,
> > 
> > I want to know what is the use of follwoing 2
> > constructors of the URILocationImpl?
> > 
> > URILocationImpl(java.io.InputStream is,
> > java.lang.String href) 
> > URILocationImpl(java.io.Reader reader,
> > java.lang.String href) 
> >           Creates a new URILocationImpl 
> > 
> > I want castor to retrive locally all the
> > schemaLocation mentioned in the import tag of
> schema.I
> > want to implement URIResolver to achieve it. For
> e.g.
> > if utility.xsd is mentioned in the schemaLocation
> > attribute then i want castor to look at
> > http//localhost:7001/MyServlet?utility.xsd. I have
> > implemented my URIResolver class and changing the
> > URILocation to the above URL but castor is giving
> me
> > ConnectException. Why? I can get this utility.xsd
> file
> > by simple URLConnection. Can above 2 constructors
> be
> > used is some way so castor can read URILocation?
> > 
> > Thanks & Regards,
> > Deepak
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > 
> > -------------------------------------------------
> > If you wish to unsubscribe from this list, please 
> > send an empty message to the following address:
> > 
> > [EMAIL PROTECTED]
> > -------------------------------------------------
> > 
> > 
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to