Resolved by adding the following to the end of the binding file:
<mapping class="java.lang.Object" abstract="true" choice="true"
ordered="false">
<namespace uri="http://www.opentravel.org/OTA/2003/05"
default="elements"/>
</mapping>
This is a 'dummy' mapping but the result is the global names and namespace
arrays get populated :-)
> -----Original Message-----
> From: Paul Mahoney [mailto:[EMAIL PROTECTED]
> Sent: 18 November 2008 19:50
> To: '[email protected]'
> Subject: bindingFactory.getElementNames() array values are ALL null
>
> My apologies, the following description is involved and
> requires some study.
>
> I have run into a problem with JibX. I using version 1.1.5 as
> that is the version installed with Axis 2.1.4. However I feel
> the issue is with my bindings an not an axis issue.
>
> I have a large collection of binding files. A simple one is
> given here:
> --------------------------------------------------------------
> --------------------
> <binding direction="both" value-style="attribute">
> <namespace uri="http://www.opentravel.org/OTA/2003/05"
> default="elements"/>
>
> <include path="OTA_AirCommonTypes.xml"/>
>
> <mapping name="OTA_PingRQ" class="uk.co.xact.ota.OTA_PingRQ">
> <value name="EchoToken" field="echoToken"
> usage="optional"/>
> <value name="TimeStamp" field="timeStamp"
> usage="optional"/>
> <value name="Target" field="target"
> deserializer="uk.co.xact.ota.commonTypes.oTA_PayloadStdAttribu
> tes.Target.get" usage="optional"/>
> <value name="Version" field="version"/>
> <value name="TransactionIdentifier"
> field="transactionIdentifier" usage="optional"/>
> <value name="SequenceNmbr" field="sequenceNmbr"
> usage="optional"/>
> <value name="TransactionStatusCode"
> field="transactionStatusCode"
> deserializer="uk.co.xact.ota.commonTypes.oTA_PayloadStdAttribu
> tes.TransactionStatusCode.get" usage="optional"/>
> <value name="RetransmissionIndicator"
> field="retransmissionIndicator" usage="optional"/>
> <value name="PrimaryLangID"
> field="primaryLangID" usage="optional"/>
> <value name="AltLangID" field="altLangID"
> usage="optional"/>
> <value name="EchoData" field="echoData"
> style="element"/>
> </mapping>
> </binding>
> --------------------------------------------------------------
> --------------------
>
> As you see, the top level name OTA_PingRQ is mapped to
> uk.co.xact.ota.OTA_PingRQ.
>
> In my test code I use the following line to get the binding factory:
>
> bindingFactoryRQ = BindingDirectory.getFactory(OTA_PingRQ.class);
>
> My basic questions is why bindingFactoryRQ.getElementNames()
> return an array of null values. The mapping OTA_PingRQ is not
> abstract.
>
> The method bindingFactoryRQ.getElementNamespaces() also
> returns an array of nulls. But this might be expected since
> the mapping is in the default namespace.
>
> Despite this, my junit test to marshal and unmarshal sample
> xml files works fine. But thing go wrong for axis2. The issue
> here is that within the AXIS skeleton code for the service it
> uses the following code in the MessageReceiverInOut class:
>
> --------------------------------------------------------------
> ----------------------
> private org.apache.axiom.om.OMElement mappedChild(Object
> value, org.apache.axiom.om.OMFactory factory) {
> org.jibx.runtime.IMarshallable mrshable =
> (org.jibx.runtime.IMarshallable)value;
> org.apache.axiom.om.OMDataSource src = new
> org.apache.axis2.jibx.JiBXDataSource(mrshable, bindingFactory);
> int index = mrshable.JiBX_getIndex();
> org.apache.axiom.om.OMNamespace appns =
> factory.createOMNamespace(bindingFactory.getElementNamespaces(
> )[index], "");
> return factory.createOMElement(src,
> bindingFactory.getElementNames()[index], appns);
> }
> --------------------------------------------------------------
> ----------------------
>
> The call to factory.creatOMNamespace() throws an NPE because
> bindingFactory.getElementNamespaces()[index] = null.
>
> I am using the WSDL2JAVA code generator with the following
> 'top-level' binding file:
>
> --------------------------------------------------------------
> ----------------------
> <binding direction="both" value-style="attribute">
> <namespace uri="http://www.opentravel.org/OTA/2003/05"
> default="elements"/>
> <include path="../../gensrc/jibx/OTA_PingRQ.xml"/>
> <include path="../../gensrc/jibx/OTA_PingRS.xml"/>
> </binding>
> --------------------------------------------------------------
> ----------------------
>
> The type section of the WSDL file is:
> --------------------------------------------------------------
> ----------------------
> <wsdl:types>
> <xs:schema>
> <xs:import
> namespace="http://www.opentravel.org/OTA/2003/05"
> schemaLocation="http://www.xact.co.uk/ota/OTA_PingRQ.xsd"/>
> <xs:import
> namespace="http://www.opentravel.org/OTA/2003/05"
> schemaLocation="http://www.xact.co.uk/ota/OTA_PingRS.xsd"/>
> </xs:schema>
> </wsdl:types>
> --------------------------------------------------------------
> ----------------------
>
> Any pointers on why the array values are all null would be
> most appreciated.
>
> Regards
>
> Paul
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users