Getting a Document Type in Java

I’m trying to write a Java widget for Integration Server, and I ran into a problem. I’d really like to let people pass a document type name (as a string) to my service, and I would manipulate the document type itself. So, I’d like to fetch a document type from the server and get an IData object for me to manipulate. This seems like a fairly basic task, but I can’t find anything in the API that would let me do it. I tried doing a Server.doInvoke(“pathtodocumenttype”,IDataObject), but it didn’t like that. If anyone has any tips I’m stumped. I’ve included a short example below in case I’m not making much sense.

I have a document type myPackage.docs:myDoc
I have 1 input to my service myPackage.service:myService, a string called docType.
I call myPackage.service:myService, passing the string “myPackage.docs:myDoc”.
I’d like to get the IData object associated with the string “myPackage.docs:myDoc”.

Jamie

> I’d like to fetch a document type from the server
> and get an IData object for me to manipulate.

Hi James - By “document type”, do you mean a webMethods record structure?

If so, the problem is that an IData element represents an instantiation of a data structure – not the abstract data structure record itself. For instance, a webMethods record (or schema) may have an element whose value must be one of a pick-list. In such a case, any IData structure for this element generated must be told which value to “pick”.

If you want to just programatically inspect IData structures, try this - create a new Java service, put complex records in the input and output of the service, then click on “Compose/ Generate Code” and have developer generate the Java code for inpecting input and output. From the Java code genereated, you should get useful tips for programatically inspecting IData structures yourself.

If you want to programatically manipulate record definitions, I haven’t come across anything that does this - I think you’d need to ask webMethods.

Thanks Sonam. In effect, I don’t want to manipulate record definitions but I want a way of getting a blank instance of a record definition. Say I have a record definition called jamie.mytest:myOrder that looks like this:

(document) myRec
(string) orderID
(string) custID
(string) productID

In java, I want to be able to retrieve a blank instance of this record definition in a call like:

Service.retrieveRecord(jamie.mytest:myOrder)

which would return a blank IData object that looked like that record definition. So I don’t really want to manipulate the definition, but I do want to retrieve it. I’m in contact with webMethods support right now and I’ll let you know what I find. Thanks for your help!

Jamie

James - That’s interesting. I guess WM would need to supply some routines to iterate over a record structure.

Do let us know what you find - I had tried to do something like this earlier, but gave up and used some Java code instead to parse the external DTD that corresponded to the imported WM record structure.

This may be a bit late posting but if you still interested in WmRoot package there are services that allow you to getNode if you have doc name tghis will represent your IData empty instance of structure But its not what you expect exactly! Its a WM record structure that is IData object with records and fields defining structure of youre document.