The process to develop this in IBM Websphere Integration Developer is as follows...
- Create BobsObject by clicking on DataTypes > new > BusinessObject.
- Create a new interface. Now create three inputs (one Int, one String and one Boolean. Then create one output of type BobsObject (i.e. the Business Object we just created)
- Drag a Java component on to your assembly diagram and ensure it that implements the above interface.
- You'll notice that because you set BobsObject as the return type in your interface, WID sets the return type for the relevant method to DataObject.
- This means you need to create a DataObject and populate it with the relevant values so that you can return it. Here's how you do that...
com.ibm.websphere.sca.ServiceManager sm = new ServiceManager();
com.ibm.websphere.bo.BOFactory bof1 = = (BOFactory)sm.locateService("com/ibm/websphere/bo/BOFactory");
commonj.sdo.DataObject d = bof1.create("http://lib1", "BobsObject");
d.setInt("Int1", 20);
d.setString("String1", "Hello World");
d.setBoolean("Bolean1", true);
The first two lines I beleive are fairly accedemic, i.e you just these things called ServiceManagers and BOFactories to creaqte DataObjects.
On line 3 you'll see the create method requires 2 arguments (marked above in red and green respectively) both of which can be found in the XSD for BobsObject or with WID's Business Object editor. The first argument in the namespace, I've set this to http://lib1 because I created the object in my WID library (who namespace is of course htp://lib1). The second argument (in this case BobsObject) threw me for a while because the documentation referred to it as "type". The actual value should be set to the name of the object. I think the reason that "type" is used refers to the fact that this is an object that can have multiple instances. I.e. this is of type BobsObject. Makes sense really, I'm instantiating a DataObject of type http://lib1/BobsObject
Lines 4, 5 and 6 set the values. You'll notice the first argument is String. Other options are Property and position. Position I understand as being the position of the associated value in terms of where it is in an array of values. I dont currently understand using Proerty as the first argument so I'll leave this for now