Re: [jibx-users] Best practice for handling multiple, alternating, namespaces?
Hi Nick, This is somewhat confusing, and the naming of the attributes used in the binding probably contributes to the confusion. The ns attribute needs to give the actual namespace URI (as stated in the documentation on these attributes: http://jibx.sourceforge.net/binding/binding-attributes.html), not the prefix. So this should work: mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1; default=elements/ namespace name=ns2 uri=http://ns2; default=none/ structure ns=http://ns2; name=metaDataProperty structure name=ProductMetaData value name=fileIdentifier field=fileId/ (where I've changed the ns value on the first structure element). When you tried the binding in its original form you should have gotten an error which said something about namespace not defined - didn't this happen? - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Scott, Nick wrote: Hi, I'm looking for guidance on the best approach to handling multiple, alternating, namespaces in jibx. The tutorial hints at a solution: http://jibx.sourceforge.net/binding/tutorial/binding-advanced.html ...This makes the namespace automatically apply to every name definition unless you override it with a specific namespace using the ns attribute but provides no example. Try as I might, I keep getting validation errors whatever permutation of attributes I go for! The problem XML is long and tedious with five different namespaces all interspersed! To illustrate the problem, consider the following fragment: ... metadata ns1:Product xsi:schemaLocation=http://earth.esa.int/geca ./xsd/geca/geca.xsd xmlns:ns1=http://ns1 http://ns1/ xmlns:ns2=http://ns2 http://ns2/ ns2:metaDataProperty ns1:ProductMetaData ns1:fileIdentifierurn:x-geca:avdc:500/geca:fileIdentifier ... If the ns2:metaDataProperty is simply removed, then the following works: ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=elements/ structure name=ProductMetaData value name=fileIdentifier field=fileId/ ... Logically, I would expect a something like: ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=elements/ namespace name=ns2 uri=http://ns2 http://ns2/ default=none/ structure ns=ns2 name=metaDataProperty structure name=ProductMetaData value name=fileIdentifier field=fileId/ ... or ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=none/ namespace name=ns2 uri=http://ns2 http://ns2/ default=none/ structure ns=ns2 name=metaDataProperty structure ns=ns1 name=ProductMetaData value ns=ns1 name=fileIdentifier field=fileId/ ... to do the trick - but they both lead to compilation errors (Namespace prefix conflict for namespace element). Is there a right approach to alternating namespaces in this manner? All help would be much appreciated! Nick Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users -- Come build with us! The BlackBerryreg; Developer Conference
Re: [jibx-users] No Unmarshallers being produced by binding
Hi Glenn, I don't know why load=true on the Ant task would cause a problem. Do you have any more information about what went wrong? Re the dateTime attributes, JiBX by default handles the conversions to and from java.util.Date with some assumptions, which may or may not be correct for your application. See http://jibx.sourceforge.net/binding/conversions.html for the details of this and other conversions. I'm finally getting out a 1.2.2 release this week which includes support for the Joda date/time classes, so you'll have other options as soon as that's available. - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Glenn2041 wrote: Found it. The Ant task org.jibx.binding.ant.CompileTask had load=true. It came in when copying an example. Removing it solved my problem. Thanks anyway -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Best practice for handling multiple, alternating, namespaces?
Cheers Dennis - you're absolutely right, I just wasn't reading the element description properly! :) I had assumed that the ns attribute would take the name value defined in a previous namespace element rather than needing the full uri to be restated. I have no justification for this other than it would make the binding files easier to read. In fact, the ideal when using multiple namespaces would be for them to be defined at the top of the binding and then referenced by their names when needed...maybe I'm just lazy! Thanks for your time. Nick -Original Message- From: Dennis Sosnoski [mailto:d...@sosnoski.com] Sent: 15 September 2009 11:43 To: JiBX users Subject: Re: [jibx-users] Best practice for handling multiple, alternating, namespaces? Hi Nick, This is somewhat confusing, and the naming of the attributes used in the binding probably contributes to the confusion. The ns attribute needs to give the actual namespace URI (as stated in the documentation on these attributes: http://jibx.sourceforge.net/binding/binding-attributes.html), not the prefix. So this should work: mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1; default=elements/ namespace name=ns2 uri=http://ns2; default=none/ structure ns=http://ns2; name=metaDataProperty structure name=ProductMetaData value name=fileIdentifier field=fileId/ (where I've changed the ns value on the first structure element). When you tried the binding in its original form you should have gotten an error which said something about namespace not defined - didn't this happen? - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Scott, Nick wrote: Hi, I'm looking for guidance on the best approach to handling multiple, alternating, namespaces in jibx. The tutorial hints at a solution: http://jibx.sourceforge.net/binding/tutorial/binding-advanced.html ...This makes the namespace automatically apply to every name definition unless you override it with a specific namespace using the ns attribute but provides no example. Try as I might, I keep getting validation errors whatever permutation of attributes I go for! The problem XML is long and tedious with five different namespaces all interspersed! To illustrate the problem, consider the following fragment: ... metadata ns1:Product xsi:schemaLocation=http://earth.esa.int/geca ./xsd/geca/geca.xsd xmlns:ns1=http://ns1 http://ns1/ xmlns:ns2=http://ns2 http://ns2/ ns2:metaDataProperty ns1:ProductMetaData ns1:fileIdentifierurn:x-geca:avdc:500/geca:fileIdentifier ... If the ns2:metaDataProperty is simply removed, then the following works: ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=elements/ structure name=ProductMetaData value name=fileIdentifier field=fileId/ ... Logically, I would expect a something like: ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=elements/ namespace name=ns2 uri=http://ns2 http://ns2/ default=none/ structure ns=ns2 name=metaDataProperty structure name=ProductMetaData value name=fileIdentifier field=fileId/ ... or ... mapping name=Product class=com.myCode.xxxProductFile namespace name=ns1 uri=http://ns1 http://ns1/ default=none/ namespace name=ns2 uri=http://ns2 http://ns2/ default=none/ structure ns=ns2 name=metaDataProperty structure ns=ns1 name=ProductMetaData value ns=ns1 name=fileIdentifier field=fileId/ ... to do the trick - but they both lead to compilation errors (Namespace prefix conflict for namespace element). Is there a right approach to alternating namespaces in this manner? All help would be much appreciated! Nick Please help Logica to respect the environment by not printing this email / Pour contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o ambiente não imprimindo este correio electrónico. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
[jibx-users] JIBX Clients
Hello, is it possible to generate JIBX Client stubs easily without a mapping file. We have an architecture where we are evaluating using JIBX as the binding for services. For the sake of consistency we would like to use it also for the SOAP clients , however it seems the client generation is not possible without a mapping file. Is it possible? br, Toni -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] Error trying to use precompiled bindings and extended classes
Thanks for the reply, Dennis. I made the changes you suggested to my bindings.xml, that seems to have fixed the previous issue but now I am receiving another error: [java] Running binding compiler version jibx_1_2_1 [java] Error running binding compiler [java] java.lang.ArrayIndexOutOfBoundsException: -2147483648 [java] at org.jibx.binding.def.PrecompiledBinding.init(PrecompiledBinding.java:125) [java] at org.jibx.binding.def.PrecompiledAbstractMapping.init(PrecompiledAbstractMapping.java:92) [java] at org.jibx.binding.def.BindingBuilder.unmarshalPrecompiledMappings(BindingBuilder.java:1925) [java] at org.jibx.binding.def.BindingBuilder.unmarshalInclude(BindingBuilder.java:2036) [java] at org.jibx.binding.def.BindingBuilder.unmarshalBindingDefinition(BindingBuilder.java:2108) [java] at org.jibx.binding.Utility.loadBinding(Utility.java:320) [java] at org.jibx.binding.Utility.loadFileBinding(Utility.java:437) [java] at org.jibx.binding.Compile.compile(Compile.java:217) [java] at org.jibx.binding.Compile.compile(Compile.java:184) [java] at org.jibx.binding.Compile.main(Compile.java:379) And here is my updated binding.xml: binding xmlns:tns0=http://accenture.com/apsp/domain; xmlns:ns0=http://accenture.com/apsp/integration/CustomerService; name=binding package=com.accenture.apsp.domain force-classes=true add-constructors=true namespace uri=http://accenture.com/apsp/domain; default=elements/ namespace uri=http://accenture.com/apsp/integration/CustomerService; prefix=ns0/ namespace uri=http://accenture.com/apsp/domain; prefix=tns0/ include path=file:///D:/Projects/APSP_integration/CrossJarDependency/gen/person-binding.xml precompiled=true/ mapping abstract=true type-name=customer class=com.accenture.apsp.domain.Customer xmlns:tns1=http://accenture.com/apsp/crossjardepend; namespace uri=http://accenture.com/apsp/crossjardepend; default=elements prefix=tns1/ structure type=com.accenture.apsp.crossjardepend.Person map-as=tns1:Person / value style=element name=firstName field=firstName usage=optional/ value style=element name=lastName field=LastName usage=optional/ value style=element name=phone field=phone usage=optional/ /mapping /binding Thanks again for your assistance! - Josh DSosnoski wrote: Hi Josh, The problem here is that your binding.xml doesn't just reference the binding defined for Person in person-binding.xml - it creates a new binding for Person, in the form of the embedded structure type=com.mycompany.apsp.crossjardepend.Person. To use the precompiled binding version, change this to structure type=com.mycompany.apsp.crossjardepend.Person map-as=tns1:person/, where tns1 is defined as http://accenture.com/apsp/crossjardepend;. - Dennis -- View this message in context: http://www.nabble.com/Error-trying-to-use-precompiled-bindings-and-extended-classes-tp25355028p25459139.html Sent from the jibx-users mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users
Re: [jibx-users] No Unmarshallers being produced by binding
Thanks for that Dennis, I've since rewrote the binding from scratch. I think it may have had something to do with the way I was handling the namespaces. Without the date format declared, 24 hour time is mishandled. All dates increase by 12 hours. The date format I'm currently using is -MM-dd'T'HH:mm:ss. Here's the binding file for reference. binding xsi:noNamespaceSchemaLocation=binding.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; namespace uri=https://localhost:9444/businesspartners/timeofuse-consumption/ws/nominations-service.wsdl; default=elements / format type=java.util.Date deserializer=nz.co.company.util.SerializationUtils.deserializeDate serializer=nz.co.company.util.SerializationUtils.serializeDate / mapping name=SubmitTimeOfUseConsumptionNominationsRequest class=nz.co.company.timeofuseconsumption.domain.SubmitTimeOfUseConsumptionNominationsRequest value style=attribute name=source field=source / value style=attribute name=messageId field=messageId usage=optional / value style=attribute name=requestDate field=requestDate / value style=attribute name=consumptionType field=consumptionType / structure name=nominations collection field=nominations create-type=java.util.ArrayList structure name=nomination type=nz.co.company.timeofuseconsumption.domain.TimeOfUseConsumptionNomination value style=attribute name=dateTimeStamp field=dateTimeStamp / value style=attribute name=consumption field=consumption / /structure /collection /structure /mapping mapping name=SubmitTimeOfUseConsumptionNominationsResponse class=nz.co.company.timeofuseconsumption.domain.SubmitTimeOfUseConsumptionNominationsResponse value style=attribute name=messageId field=messageId usage=optional / value style=attribute name=processedDate field=processedDate / value style=attribute name=responseCode field=responseCode / value style=element name=responseMessage field=responseMessage usage=optional / /mapping /binding Thanks Glenn Gilbert Dennis Sosnoski wrote: Hi Glenn, I don't know why load=true on the Ant task would cause a problem. Do you have any more information about what went wrong? Re the dateTime attributes, JiBX by default handles the conversions to and from java.util.Date with some assumptions, which may or may not be correct for your application. See http://jibx.sourceforge.net/binding/conversions.html for the details of this and other conversions. I'm finally getting out a 1.2.2 release this week which includes support for the Joda date/time classes, so you'll have other options as soon as that's available. - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Glenn2041 wrote: Found it. The Ant task org.jibx.binding.ant.CompileTask had load=true. It came in when copying an example. Removing it solved my problem. Thanks anyway -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf___ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users