Hi Werner,

Thanks for the info.

I am not generating code. I am converting Jdom Element to castor schema. This 
way I can easily read the content of type schema.

If Type schema has imports with references to other XDS, there is no problem 
with the conversion. Here I was testing the import of definition not the schema 
and its shown in the original link

http://www.ibm.com/developerworks/xml/library/ws-tip-imports.html (listing 4 
and 5)

Thanks,
Sasan




________________________________
From: Werner Guttmann <[email protected]>
To: [email protected]
Sent: Mon, November 30, 2009 9:36:44 PM
Subject: Re: [castor-user] WSDL import - castor exception

Hi everybody,

let me expand on this one a bit more, trying to clarify a few things in
the context of using Castor with WSDLs, XML schemas, etc.

James is right in that Castor is not a WS framework such as Axix, Spring
WS et alias are. As such, it can not be used to generate code from a
WSDL definition per se, with stubs and skeletons etc. But Castor XML has
a code generator part that allows you to generate Java classes (mainly
POJOs) from XML schemas.

But let's take a step back: a WSDL definition includes a type section
where you normally define the request and response payloads of your
operations. Whilst this is not mandated, all type definitions could
(should) be moved to a separate XML schema (a set thereof) and those be
included within the type section of the WSDL. In this case, Castor XML
could be used to generate Java classes from the XML schema, and that's
exactly how it is frequently used.

Have a look at

http://castor.org/ws-integration.html

where you'll find a lost of WS frameworks that have integrated support
for this kind of code generation through XML data binding frameworks.

In commercial projects I have to come to appreciate Spring WS and it's
Spring OXM support, a small abstraction layer around the most widely
used XML data binding frameworks. Most of this frameworks encourage you
to off-load code generation for your message/operation payloads to XML
data binding tool of choice, and have those tighlty integrated with your
WS framework of choice.

I am more than willing to share more information on this technology mix
if needed. If it takes a lot of time to answer those questions, I might
ask you to take on professional support with me through
[email protected].

Cheers
Werner



James Cowan wrote:
> Castor is an XSD compiler not a WSDL compiler.
> 
> I think you need to use Apache Axis or CXF WSDL compilers to handle this. If 
> there was a WSDL compiler
> that used Castor to generate the data structures I would be very interested. 
> The pojos produced
> by the WSDL compilers are nothing like as readable as the ones produced by 
> Castor.
> 
> James
>   ----- Original Message ----- 
>   From: Sasan 
>   To: [email protected] 
>   Sent: Monday, November 30, 2009 4:31 PM
>   Subject: [castor-user] WSDL import - castor exception
> 
> 
>   Hi,
> 
> 
>   I am trying to parse the example provided in the link
> 
>   Listing4 which imports Listing 5
> 
>  http://www.ibm.com/developerworks/xml/library/ws-tip-imports.html
> 
>   Note: I am providing the link only because the xml in question is slightly 
> big for copy paste here, I hope you don't mind.
> 
>   However I get the error when parsing the "Type"
> 
>   Unable to resolve Schema corresponding to namespace 
> 'http://www.w3.org/2001/XMLSchema'.
>   org.exolab.castor.xml.schema.SchemaException: Unable to resolve Schema 
> corresponding to namespace 'http://www.w3.org/2001/XMLSchema'.
>       at 
> org.exolab.castor.xml.schema.reader.ImportUnmarshaller.<init>(ImportUnmarshaller.java:125)
>       at 
> org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUnmarshaller.java:604)
>       at 
> org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2ComponentReader.java:255)
>       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
> Source)
>       at 
> org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown 
> Source)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
>  Source)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>  Source)
>       at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source)
>       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>       at 
> org.exolab.castor.xml.schema.reader.SchemaReader.read(SchemaReader.java:301)
>   <more>
> 
> 
>   Is this a limitation introduced by castor? 
> 
>   any info will be much appreciated.
> 
>   Thanks,
>   S.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to