Ok, I will try my best... -----Original Message----- From: Davanum Srinivas [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 8:18 AM To: [EMAIL PROTECTED] Subject: RE: 1.2 alpha and castor serialization
Ozzie, Can you please submit a stripped down complete sample that we can drop into say samples/castor directory in Axis 1.2 Beta release? (http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches ) Thanks, dims --- "Gurkan, Ozzie (MAN-Corporate)" <[EMAIL PROTECTED]> wrote: > 1. Castor generates special classes when you use the "xs:restriction" > for simpleType in the schema. These special classes have no public > constructors and can only be created via the use of "valueOf" method. > Since Java doesn't provide "Enum" data types like C, C++ does, > everyone has their own type-safe Enum implementation, and Castor is > one of them. > > 2. You only need to add custom typeMappings into wsdd for these Enum > type classes. The other generated classes are JavaBeans that have > public no-arg constructors and hence are mappable using beanMappings > tags in the wsdd file. > > 3. Yes. > > 4. Yes. The namespaces are read from the schema file and are not lost. > The only thing that happens is that you now have control over the java > package names. > > 5. Right, you don't need to give the client any custom > serializer/deserializers, since the WSDL file will automatically > contain the correct schema for generation. > > 6. Once you have the wsdd setup correctly on the server-side, generate > the WSDL file by running the server and pointing to ?wsdl URI. Then > feed this file into the Wsdl2Java class provided by Axis. As a matter > of fact, you can feed the URL to WSDL directly into the generator. > Here is a batch file snippet to run the Wsdl2Java generator: > > <snip> > set > axis.jar=%JAVALIBS%\jakarta\axis\1_1RC1\lib\axis.jar;%JAVALIBS%\jakart > a\axis > \1_1RC1\lib\saaj.jar;%JAVALIBS%\jakarta\axis\1_1RC1\lib\jaxrpc.jar;%JAVALIBS > %\jakarta\axis\1_1RC1\lib\commons-logging.jar;%JAVALIBS%\jakarta\axis\1_1RC1 > \lib\commons-discovery.jar > set > xerces.jar=%JAVALIBS%\jakarta\xerces\2.2.1\lib\xercesImpl.jar;%JAVALIBS%\jak > arta\xerces\2.2.1\lib\xmlParserAPIs.jar > set cp=%classpath%;%axis.jar%;%xerces.jar% > > java -cp %cp% org.apache.axis.wsdl.WSDL2Java > http://localhost:8080/server/axis/Services?wsdl > </snip> > > There is also good documentation on the Axis website on how to use it, > too. > > -----Original Message----- > From: Pradeep Jonnalagadda [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 2:46 PM > To: [EMAIL PROTECTED] > Subject: RE: 1.2 alpha and castor serialization > > > > Hi Ozzie, > Thanks for the help. I have few questions based on > ur email reply. 1. What are castor enum type classes. 2. Do i have > to change typmapping for every entry in deploy.wsdd file to refer to > CastorEnumTypeSerializorFactory/CastorEnumTypeSerializorFactory or > only few selected castor classes files.If so what kind of castor > files?? 3. Can we use Doc/literal with ur approach. 4.When you define > namespaces package mappings in castorbuilder.properties file and > generate source with source generator do you see namespace references > in Descriptor files??. For example the descriptor code might look like this > public AliasDescriptor() { > super(); > nsURI = "http://beans"; > setExtendsWithoutFlatten(new beans.AliasTypeDescriptor()); > xmlName = "Alias"; > } //-- > > 5. Can i infer that i do not need to make any changes on client side > .Can u send ur client code??. 6. How do you generate client code from > thw wsdl?. Ur answers would help a, lot. thx pradeep. > > > ---------------------------------------------------------------------- > ------ > ------------ > > This is a PRIVATE message. If you are not the intended recipient, > please delete without copying and kindly advise us by e-mail of the > mistake in delivery. NOTE: Regardless of content, this e-mail shall > not operate to bind CSC to any order or other contract unless pursuant > to explicit written agreement or government initiative expressly > permitting the use of e-mail for such purpose. > ---------------------------------------------------------------------- > ------ > ------------ > > > > > > > "Gurkan, Ozzie > > (MAN-Corporate)" To: > "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > > <Ozzie.Gurkan cc: > > @cox.com> Subject: RE: 1.2 alpha and > castor serialization > > > 12/11/2003 01:04 > > PM > > Please respond > > to axis-user > > > > > > > > > > One other advantage to my approach is that the client side doesn't > need the Castor Serializer/Deserializers at all--not even the enum > type. That is because I allow the WSDL to be created by Axis Server > automatically and hence the WSDL2Java creates pure Bean > Serializer/Deserialzer code. As a matter of fact, I don't generate > client code anymore. I just tell my clients to get the WSDL and > generate it themselves. They have no clue that I am using Castor beans > in the background! > > Ozzie > > -----Original Message----- > From: Gurkan, Ozzie (MAN-Corporate) [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 1:37 PM > To: '[EMAIL PROTECTED]' > Subject: RE: 1.2 alpha and castor serialization > > > Unlike the article, I don't include the XSD in the WSDL file. I let > the automatic WSDL generation process that Axis does generate it for > me. I do generate the castor classes (along with the *Descriptor > classes) from the XSD file and define these as beanMappings: > > <!-- Custom serializer/deserializer for > Castor Enum > types--> > <typeMapping > deserializer > ="org.apache.axis.encoding.ser.castor.CastorEnumTypeDeserializer > Factory" qname="ns19:creditBrokerSelected" > serializer > ="org.apache.axis.encoding.ser.castor.CastorEnumTypeSerializerFact > ory" > type=" > java:com.manheim.service.creditreport.schema.types.CreditBrokerSelecte > dType" > xmlns:ns19="http://creditreport.service.portal.manheim.com/2003/8"/> > > <!-- Normal BeanMapping tag for a Castor bean > class > --> > <beanMapping > languageSpecificType=" > java:com.manheim.service.creditreport.schema.CreditChe > ckRequest" qname="ns176:creditCheckRequest" > xmlns:ns176="http://creditreport.service.portal.manheim.com/2003/8"/> > <beanMapping > languageSpecificType=" > java:com.manheim.service.creditreport.schema.CreditChe > ckResponse" qname="ns176:creditCheckResponse" > xmlns:ns176="http://creditreport.service.portal.manheim.com/2003/8"/> > > I am using RPC/encoded style and had it successfully working with > literal, too. The only difference is that when you are doing > "literal", you have to set the "encodingStyle" on the typeMapping > element to a "". > > So, the difference from the article is that I don't allow delegation > of the entire SOAP body to a CastorSerializer, which ends up using > DOM--that is incredibly bad! I can attach the code for the EnumType > serializer, if you do need it. > > A couple things to note on the code generation: > - I almost always use namespace mapping to generate proper class > package names. That is specified in castorbuilder.properties. > - I wrap my messages with request and response objects. See > beanMapping elements, CreditCheckRequest and CreditCheckResponse. > These objects inherit a ServiceRequest and ServiceResponse abstract > class. > > Advantages: > - No hand modification to WSDL. Use the ?wsdl to auto generate with no > customization. > - Uses standard BeanSerializer/Deserializer methods, which are > optimized to use SAX pipeline. > - Minimal customization for EnumTypes, which doesn't use DOM, and > automatically generates the proper schema for WSDL. > - Works with RPC encoded/literal, etc. > > > Ozzie Gurkan > > -----Original Message----- > From: Pradeep Jonnalagadda [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 11:12 AM > To: [EMAIL PROTECTED] > Subject: RE: 1.2 alpha and castor serialization > > > === message truncated === ===== Davanum Srinivas - http://webservices.apache.org/~dims/