Problem using the Broker Client API

Hi,

We are using the Java BrokerClient API to push data to webMethods from some external application.

I have defined the Broker Document Type that will be published by this client. Now in the client program I’ve created a class structure that matches the structure of this Broker document.
I’m using the following BrokerEvent method to poulate event with this Java object
event.fromObject(javaObject);

While running the client code, I dont see any errors, and document is getting published successfully to the broker. But none of the fields are getting populated, and I see a blank document in the documentTracker.

Am not sure what I’m missing? Any help is highly appreciated.

Thanks,
Naveen

If I remember correctly, the fields in the Java object must be public and/or use public setters/getters. The names of the Java class fields must match the BrokerEvent fields exactly.

What version of the API are you using? The 6.5 docs state that BrokerEvent.fromObject(obj) is deprecated–and they dont’ say what to use instead so we may now be stuck with setField() calls.

Thanks Reamon for your quick response.

Yes, you are correct I’m using 6.5 API, and the fromObject in 6.5 is marked as deprecated.

I tried using the 6.1 APIs and now it seems there is something wrong with the java class & the BrokerEvent fields. Now, I’m getting [SIZE=2]
COM.activesw.api.client.BrokerFieldTypeMismatchException.

I traced the code & found that it is not able to find a field “envelope.applicationDataText” in the Broker Document.

Have attached the snapshot for the Broker Document type, and the java class that I defined for it. Pls suggest.

Thanks for your help.
Naveen
[/size]
BrokerDocType-1.JPG

You can try flattening your structure. It’s trying to find a field named “envelope.applicationDataText” which doesn’t exist. There is a structure named envelope and within there is a field named applicationDataText.

I would suggest abandoning the fromObject method and explicitly setting the BrokerEvent fields from your object fields as needed.

Thanks Reamon for your help & suggestions!

Yes, because of the poor API’s, I’ve decided to use the field-by-field setting approach.

Thanks much,
Naveen

Hi,

I have hit a wall in one of my project wherein we are dealing with Packed-Decimal data sent by a Mainframe (COBOL COMP-3) application.

I tried using the PSUtilities.format:convertPackedDecimalToString and MainframeSampleServices.Conversion.convertPackedDecimal:ConvertPackedDecimalToString

but both of these services are designed to read only Integers, and in my case the packed number might be a 11 -digit number which these services are unable to handle and are resulting a negative number.

I tried tweaking the service so that they can handle a long, but its not working as expected.

Any help is highly appreciated?

Thanks,
Naveen Gupta