Hello Friends,

Earlier, I was having trouble with un-marshalling xml becase the xml I was
trying to process does not contain name spaces in a consistent manner.

According to Dennis's suggestion, I have tried to remove the
default="elements" in the namespace element, with no success. Now I've been
working on his other suggestion of multiple bindings and unfortunately I'm
getting nowhere with the errors. I know I'm very new to the jibx library, so
I'm willing to try a little more harder and in this respect, I'd like to
seek some help in regards to the direction I'm going in. I'd very much
appreciate if any kind soul points me to an example, or a document that
explains the process of multiple bindings.

Here's what I have
The mappings
--------------------------------------------
header-binding.xml
<binding>
  <mapping name="header" class="com.organ.server.ibml.jibx.jibx.JibxHeader"
>
        <structure name="messageId" field="messageId" map-as="messageId"/>
        <structure name="inReplyTo" field="messageId" map-as="messageId"/>
        <value name="sentBy" field="sentBy"/>
        <value name="sentTo" field="sendTo"/>
        <value name="creationTimestamp" field="creationTimestamp"/>
  </mapping>

  <mapping class="com.organ.server.ibml.jibx.jibx.JibxId"
type-name="messageId" abstract="true">
        <value name="messageIdscheme" style="attribute"
field="messageIdscheme"/>
        <value style="text" field="id"/>
  </mapping>
</binding>

fpml-binding.xml
<binding>
        <namespace prefix="ns" uri="http://www.fpml.org/2005/FpML-4-2";
default="elements"/>
        <namespace prefix="xsi" uri="
http://www.w3.org/2001/XMLSchema-instance"/>
        <namespace prefix="ibml" uri="http://www.ibml.jpmorgan.com/2005"/>

  <mapping name="FpML" class="com.organ.server.ibml.jibx.FpML">
        <value style="attribute" name="version" field="version"/>
        <value style="attribute" name="ibmlVersion" field="ibmlversion"/>
        <value style="attribute" ns="
http://www.w3.org/2001/XMLSchema-instance"; name="schemaLocation"
field="xsiSchemaLocation"/>
        <value style="attribute" ns="
http://www.w3.org/2001/XMLSchema-instance"; name="type" field="xsiType"/>
  </mapping>
</binding>

response-data-binding.xml
<binding>
        <namespace prefix="ns" uri="http://www.fpml.org/2005/FpML-4-2"; />
        <namespace prefix="xsi" uri="
http://www.w3.org/2001/XMLSchema-instance"/>
        <namespace prefix="ibml" uri="http://www.ibml.jpmorgan.com/2005";
default="elements"/>

  <mapping name="response" class="
com.organ.server.ibml.jibx.jibx.JibxTradeResponse">
        <collection field="additionalData" factory="
com.organ.server.ibml.jibx.JibxTradeResponse.createResponseDataList">
                <structure name="ibml:additionalData" type="
com.organ.server.ibml.jibx.JibxResponseData" >
                        <value style="attribute"
name="additionalDataScheme"  field="additionalDataScheme"/>
                        <value name="ibml:additionalData" field="value"/>
                </structure>
        </collection>

  </mapping>
</binding>

my xml

XML
----------
<FpML 
xmlns="http://www.fpml.org/2005/FpML-4-2";<http://www.fpml.org/2005/FpML-4-2>xmlns:ibml="
http://www.ibml.organ.com/2005"; <http://www.ibml.organ.com/2005> xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";<http://www.w3.org/2001/XMLSchema-instance>xsi:schemaLocation="
http://ibml.organ.com/2005../../xsd/IBML-1-1-6-EXP.xsd";<http://ibml.organ.com/xsd/IBML-1-1-6-EXP.xsd>
xsi:type="ibml:CreateTradeRequest" version="4-2" ibmlVersion="1-1">
<header>
 <messageId messageIdscheme="
     
http://irfe.organ.com/coding-scheme/messageId";>8765</messageId><http://irfe.organ.com/coding-scheme/messageId>
 <inReplyTo messageIdscheme="
     
http://app.organ.com/coding-scheme/messageId";>YK1234DN</inReplyTo><http://app.organ.com/coding-scheme/messageId>
 <sentBy></sentBy>
 <sentTo>UAT</sentTo>
 <creationTimestamp>2007-08-28 18:55:02</creationTimestamp>
</header>
<ibml:responseData>
<ibml:additionalData additionalDataScheme="
    http://app.organ.com/coding-scheme/batch-number
    ">YK1234</ibml:additionalData>
<ibml:additionalData additionalDataScheme="
      http://irfe.organ.com/coding-scheme/contract-number
     ">123456</ibml:additionalData>
<ibml:additionalData additionalDataScheme="
  http://tss.organ.com/coding-scheme/contract-number/leg-1
     ">1234566</ibml:additionalData>
<ibml:additionalData additionalDataScheme="
    http://irfe.organ.com/coding-scheme/trade-status-code
      ">TF123456</ibml:additionalData>
<ibml:additionalData additionalDataScheme="

http://irfe.organ.com/coding-scheme/trade-status-description";>Messaging<http://irfe.organ.com/coding-scheme/trade-status-description>
        transaction request accepted</ibml:additionalData>
</ibml:responseData>
</FpML>

I have compiled all three binding files together, I see the following
output(only relevant parts)
Using bindings:
 fpml-binding.xml
 header-binding.xml
 response-data-binding.xml
element wrapper FpML
element wrapper header
element wrapper response


and when I run my test class to un-marshall I'm getting an exception binding
name not found for the class..
here's my java code
            IBindingFactory bfact =  BindingDirectory.getFactory("header",
JibxHeader.class);
            IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
            Object obj = uctx.unmarshalDocument(new FileInputStream("
data.xml"), null);
            printObject(obj);
>From the compiler output, I can clearly see that the class JibxHeader is
bound with the name header, and yet when I run my test class it complains
that the binding is not found.

Can anyone please throw some light on this?

Thanks very much for your help.
Best Regards,
Panduga
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to