I finally got this working!

The trick was that I declared a new type with a name equal to the element
name extending initial element type. In my case 'RequestMessageCR' is the
name of a new type.

This is the working code:

public void doTest(String args[]) throws MalformedURLException {

                URL wsdlURL = new File(
                        
"D:/workspace/Fuse/camel-spring-bundle/src/main/resources/wsdl/Service.wsdl")
                                .toURI().toURL();

                IWSExportBaseImportIWSHttpService ss = new
IWSExportBaseImportIWSHttpService(
                                wsdlURL, SERVICE_NAME);
                BaseImportIWS port = ss.getIWSExportBaseImportIWSHttpPort();

                HelperContext scope = SDOUtil.createHelperContext();

                loadTypesFromXMLSchemaFile(scope, "/wsdl/Wrapper.wsdl");

                DataFactory factory = scope.getDataFactory();
                DataObject _createRequest_createRequestParameters = 
factory.create(
                                "http://myco.com/ws";, "RequestMessageType");

                DataObject typeDef = 
scope.getDataFactory().create("commonj.sdo",
                                "Type");

                String elName = "RequestMessageCR";
                typeDef.set("uri", "http://myco.com/ws";);
                typeDef.set("name", elName);

                Type baseT = scope.getTypeHelper().getType(
                                "http://myco.com/ws";, "RequestMessageType");
                List baseTypes = new ArrayList();
                baseTypes.add(baseT);
                typeDef.setList("baseType", baseTypes);

                DataObject cr = null;
                scope.getTypeHelper().define(typeDef);

                cr = factory.create("http://myco.com/ws";, elName);
                cr.set("processID", "1");

                {
                        System.out.println("Invoking createRequest...");
                        commonj.sdo.DataObject _createRequest__return = port
                                        .createRequest(cr);
                        System.out
                                        .println("createRequest.result=" + 
_createRequest__return);

                }

        }



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Using-SDOs-commonj-sdo-DataObject-with-CXF-tp5714321p5714415.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to