Hi Paul, Hi Stevo
On 14.01.2010 15:18, Paul French wrote:
It is a supplied WSDL, but yes I could modify.
However we want to adopt Spring-WS and Castor for our web services here so
would like to keep it simple as possible for the junior developers for any
WSDL supplied.
Which is easy to understand.
Basically I'm trying to come up with a basic set of instructions for others
to follow. If I can avoid XSD modification and mapping files that would be a
big plus. Sounds like you have to do one or the other when the XSD does not
follow a specific pattern that Castor can handle.
No, there's other options. In your specific case, simply instruct
Castor's code generator to switch to a different mode than the 'console
mode' you are using.
Let's see:
http://castor.codehaus.org/reference/html-single/index.html#d0e5140
should have enough information to get your started. If not, feel free to
ask more questions.
Regards
Werner
Thanks
Paul
From: Stevo Slavić [mailto:[email protected]]
Sent: 14 January 2010 13:47
To: [email protected]
Subject: Re: [castor-user] Source Generator Problems
Couldn't you refactor XSD, create an AbstractResponseType complex type with
Errors element, and then have all these specific responses to extend it?
Regards,
Stevo.
On Thu, Jan 14, 2010 at 11:19 AM, Paul French<[email protected]>
wrote:
I have tried using castor to generate java objects from an XSD, I get the
following warnings.
Warning: A class name generation conflict has occured between element
'/complexType:CancelTaskResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
Warning: A class name generation conflict has occured between element
'/complexType:InsertTaskEventResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
Warning: A class name generation conflict has occured between element
'/complexType:RejectQuoteResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
As it happens the generated source compiles fine since the Errors object
generated is the same anyway as you would expect since the "Errors" element
is based on the same type. Example from XSD
<xsd:complexType name="UpdateTaskResponseType">
<xsd:sequence>
<xsd:element minOccurs="0" name="Errors" nillable="true"
type="tns:ArrayOfErrorType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CompleteTaskResponseType">
<xsd:sequence>
<xsd:element minOccurs="0" name="Errors" nillable="true"
type="tns:ArrayOfErrorType" />
</xsd:sequence>
</xsd:complexType>
Why does Castor try and build a java class for each Errors element? I know I
could use a binding file to solve but I will end up with a different java
class for every Errors element when in fact what Castor has finally produced
is what I require?
I thought I would try the setting...
org.exolab.castor.builder.automaticConflictResolution=true
in my castorbuilder.properties file.
I now get:
14-Jan-2010 10:03:43 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType
] against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:InsertTaskTimeResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)n
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:CancelTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:GetTaskByIdResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:AcceptQuoteResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:CompleteTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:UpdateLevelOfCompletionResponseType/Errors[/complexType:ArrayOf
ErrorType] against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertTaskEventResponseType/Errors[/complexType:ArrayOfErrorTyp
e] against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:ReissueQuoteResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:UpdateTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:FinishTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType
] against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertResourceAbsenceResponseType/Errors[/complexType:ArrayOfEr
rorType] against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:RejectQuoteResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:UpdateArrivalTimeResponseType/Errors[/complexType:ArrayOfErrorT
ype] against another local element of the same name.
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry
printStatistics
INFO: *** Summary ***
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry
printStatistics
INFO: Local name conflicts encountered for the following element definitions
14-Jan-2010 10:03:58 org.exolab.castor.builder.JClassRegistry
printStatistics
INFO:<forces>
</forces>
Please note that I have to answer "N" to the question below to get the above
output.
Warning: A class name generation conflict has occured between element
'/complexType:InsertTaskTimeResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)n
If I answer "Y" when prompted I get:
14-Jan-2010 10:10:16 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertTaskTimeResponseType/Errors[/complexType:ArrayOfErrorType
] against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:InsertTaskTimeResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
14-Jan-2010 10:10:31 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:UpdateTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:UpdateTaskResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
14-Jan-2010 10:10:35 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertResourceAbsenceResponseType/Errors[/complexType:ArrayOfEr
rorType] against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:InsertResourceAbsenceResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
14-Jan-2010 10:10:36 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:InsertTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:InsertTaskResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
14-Jan-2010 10:10:36 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:CompleteTaskResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
Warning: A class name generation conflict has occured between element
'/complexType:CompleteTaskResponseType/Errors' and element
'/complexType:GetTaskTimeByIdResponseType/Errors'. Please use a Binding file
to solve this problem.Continue anyway [not recommended] (y|n|?)y
14-Jan-2010 10:10:37 org.exolab.castor.builder.JClassRegistry bind
INFO: Resolving conflict for local element
/complexType:AcceptQuoteResponseType/Errors[/complexType:ArrayOfErrorType]
against another local element of the same name.
Etc etc...
The code generated is the same whether I say "Y" or "N" and is the same
whether I set org.exolab.castor.builder.automaticConflictResolution=true or
false.
Any pointers please?
Thanks
Paul
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email