Hi,
I am trying to run the sample code but there is some problem in execution time 
plz. help me to resolve this problem.

Thank's and regards
Pradeep Yadav
=====================================================================
Source code is:
=========
package com.witneybank.olb;

import java.util.List;

import org.apache.tuscany.samples.sdo.SampleBase;
import org.apache.tuscany.samples.sdo.internal.SampleInfrastructure;

import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.helper.XMLDocument;


/**
 * Reads purchase order DataObject from XML, based upon Fuhwei Lwo's paper <A
 * HREF=
 * "http://www-128.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/";>
 * Create and read an XML document based on XML Schema</A>.
 * <p>
 * <h3>Running this Sample</h3> See <A HREF="../../../../../../index.html"
 * target="_top">the main overview</A> for instructions on how to run this
 * sample.
 * 
 */
public class ReadPurchaseOrder extends SampleBase {

        public static String purchaseOrderDoc = "<?xml version=\"1.0\" 
encoding=\"ASCII\"?>\n"
                        + "    <po:purchaseOrder 
xmlns:po=\"http://www.example.com/PO\"; orderDate=\"1999-10-20\">\n"
                        + "      <shipTo country=\"US\">\n"
                        + "        <name>Alice Smith</name>\n"
                        + "        <street>123 Maple Street</street>\n"
                        + "        <city>Mill Valley</city>\n"
                        + "        <state>CA</state>\n"
                        + "        <zip>90952</zip>\n"
                        + "      </shipTo>\n"
                        + "      <billTo country=\"US\">\n"
                        + "        <name>Robert Smith</name>\n"
                        + "        <street>8 Oak Avenue</street>\n"
                        + "        <city>Mill Valley</city>\n"
                        + "        <state>PA</state>\n"
                        + "        <zip>95819</zip>\n"
                        + "      </billTo>\n"
                        + "      <po:comment>Hurry, my lawn is going 
wild!</po:comment>\n"
                        + "      <items>\n"
                        + "        <item partNum=\"872-AA\">\n"
                        + "          <productName>Lawnmower</productName>\n"
                        + "          <price>148.95</price>\n"
                        + "          <quantity>1</quantity>\n"
                        + "          <po:comment>Confirm this is 
electric</po:comment>\n"
                        + "        </item>\n"
                        + "        <item partNum=\"926-AA\">\n"
                        + "          <productName>Baby Monitor</productName>\n"
                        + "          <price>39.98</price>\n"
                        + "          <quantity>1</quantity>\n"
                        + "          <shipDate>1999-05-21</shipDate>\n"
                        + "        </item>\n"
                        + "      </items>\n"
                        + "    </po:purchaseOrder>\n";

        public ReadPurchaseOrder(Integer commentaryLevel) {
                super(commentaryLevel, SampleInfrastructure.SAMPLE_LEVEL_BASIC);
        }

        public static void main(String[] args) {

                ReadPurchaseOrder sample = new 
ReadPurchaseOrder(COMMENTARY_FOR_NOVICE);

                 sample.run();
//              try {
//                      sample.runSample();
//              } catch (Exception e) {
//                      e.printStackTrace();
//              }

        }

        /*
         * metadata for the sample documenting the areas of SDO that are 
explored
         */
        public static int[] CORE_FUNCTION = { SDOFacets.LOADING_DATA_FROM_XML,
                        SDOFacets.SAVING_DATA_TO_XML };
        public static int[] SIGNIFICANT_FUNCTION = { 
SDOFacets.GET_PROPERTIES_OF_DATAOBJECT_BY_NAME };

        public void runSample() throws Exception {

                // commentary(COMMENTARY_ALWAYS,
                // "This sample is based upon Fuhwei Lwo's paper \n"+
                // 
"http://www-128.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/\n";
                // );
                System.out.println("1111111111111111111");
                HelperContext scope = createScopeForTypes();
                System.out.println("222222222222");

                // loadTypesFromXMLSchemaFile(scope,
                // SampleInfrastructure.PO_XSD_RESOURCE);

                // commentary(
                // "We load the purchase order document into an instance of 
XMLDocument\n\n"
                // +
                // "XMLDocument xmlDoc = getXMLDocumentFromString(scope, 
purchaseOrderDoc);\n"
                // );

                XMLDocument xmlDoc = getXMLDocumentFromString(scope, 
purchaseOrderDoc);
                System.out.println("3333333333333333");
                // commentary(
                // "We then retrieve the root DataObject from the 
XMLDocument\n"+
                // "then print out some of the details\n\n"+
                // "DataObject purchaseOrder = xmlDoc.getRootObject();");
                System.out.println("4444444444444444");
                DataObject purchaseOrder = xmlDoc.getRootObject();
                System.out.println("Order date: " + 
purchaseOrder.get("orderDate"));
                System.out.println("Comment: ccccc" + 
purchaseOrder.get("comment"));

                DataObject shipTo =purchaseOrder.getDataObject("shipTo");

                System.out.println("555555555555555");
                System.out.println("Ship to name: " + shipTo.get("name"));

                // DataObject billTo = purchaseOrder.getDataObject("billTo");
                // System.out.println("Bill to name: " + billTo.get("name"));
                //System.out.println();

//              DataObject items = purchaseOrder.getDataObject("items");
//
//              List itemList = items.getList("item");
//              for (int i = 0; i < itemList.size(); i++) {
//
//                      DataObject item = (DataObject) itemList.get(i);
//
//                      System.out.println("Part num: " + item.get("partNum"));
//                      System.out.println("Product name: " + 
item.get("productName"));
//              }

        }

}

after execution the exception is:
====================
-                                                                               
               -
- HelperContext scope = SDOUtil.createHelperContext();                          
               -
------------------------------------------------------------------------------------------------

222222222222
---------------------------------------------------------------------------
- The XMLHelper can be used to create an SDO XMLDocument instance from an -
-                                                                         -
- inputStream = new ByteArrayInputStream(xmlDoc.getBytes());              -
- result = scope.getXMLHelper().load(is);                                 -
---------------------------------------------------------------------------

3333333333333333
4444444444444444
Order date: 1999-10-20
Comment: ccccc[org.apache.tuscany.sdo.impl.anytypedataobjecti...@e9c0e9c 
(mixed: [xml.type:text=Hurry, my lawn is going wild!], anyAttribute: null)]
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Something unexpected has gone wrong with the execution of this sample program 
               !
! Please take a look at the exception and see if its something wrong with your 
environment     !
! If you can't figure it out please send a note to the 
[email protected] mailing list !
! including the text of the exception and any other useful information, thanks  
               !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

--------------------------------------------------------------
-     End of sample com.witneybank.olb.ReadPurchaseOrder     -
--------------------------------------------------------------

java.lang.ClassCastException: 
org.eclipse.emf.ecore.util.FeatureMapUtil$FeatureEList incompatible with 
commonj.sdo.DataObject
        at 
org.apache.tuscany.sdo.impl.DataObjectImpl.getDataObject(DataObjectImpl.java:331)
        at 
com.witneybank.olb.ReadPurchaseOrder.runSample(ReadPurchaseOrder.java:113)
        at 
org.apache.tuscany.samples.sdo.internal.SampleInfrastructure.run(SampleInfrastructure.java:311)
        at com.witneybank.olb.ReadPurchaseOrder.main(ReadPurchaseOrder.java:67)

Reply via email to