Custom Object in Java Service


 I need to convert an IData to a custom object from an external application, but in the output pipeline the Object that I create in my Java Service appear with the null Value.
 I´m using webMethods 6.5, and the following code:

IDataCursor pipelineCursor = pipeline.getCursor();

IData B2BMsgDoc = IDataUtil.getIData(pipelineCursor, “B2BMessageDocument”);

IDataCursor B2BMsgDocCursor = B2BMsgDoc.getCursor();
B2BMessage b2bMsgObj = new B2BMessage();
IData out = IDataFactory.create();
IDataCursor outIdc = out.getCursor();

b2bMsgObj.setAdapterId(IDataUtil.getString (B2BMsgDocCursor, “adapterId”));
b2bMsgObj.setBillingCode(IDataUtil.getString (B2BMsgDocCursor, “billingCode”));

IDataUtil.put(outIdc,“B2BMessageObject”, new B2BMessage());

The B2BMessageObject appears with value “null” on the pipeline out.

I think the right one should be:

IDataUtil.put(outIdc,“B2BMessageObject”, b2bMsgObj);
IDataUtil.put(pipelineCursor,“OutB2BMessageObject”,out); <— why do you do this ?

Please check your code; doesn’t seem right to me.
Normally if you want to use 2 cursors, one for inout and the other for output, you would destroy the input cursor and put everything in the output cursor only.


I agree with kkurnia, try replacing line:
IDataUtil.put(outIdc,“B2BMessageObject”, new B2BMessage());
IDataUtil.put(outIdc,“B2BMessageObject”, b2bMsgObj);

Also, is there a reason why you want to put the B2BMessage object within an IData object before adding it to the pipeline? Why not just do:
IDataUtil.put(pipelineCursor, “B2BMessageObject”, b2bMsgObj);

If you did this, you could eliminate 3 lines from your code, making it a little easier to read.

Last note: be sure to use try-catch-finally blocks where needed and destroy your cursors.

  • Percio

Hi kkurnia, Hi castropb ! :wink:

 The tips about changing the line:
    IDataUtil.put(outIdc,"B2BMessageObject", new B2BMessage());
        IDataUtil.put(outIdc,"B2BMessageObject", b2bMsgObj);
 I had done before posting to this thread. I put the "new B2BMessage()" to test the reason about the null value. 
 I tried to put the Object in the pipelineCursor, instead of using another Cursor, put the problem persists.

 The code was write with the try-catch-finally blocks, and all cursor were destroyed. To elimante the "ghost" of the 

cursor destroy absence by another javaService running in the server, I restarted the IS, but the problem persistis.

 My entire code is:
 IDataCursor pipelineCursor = pipeline.getCursor();
 IData B2BMsgDoc = IDataUtil.getIData(pipelineCursor, "B2BMessageDocument");
 IDataCursor B2BMsgDocCursor = B2BMsgDoc.getCursor();
 B2BMessage b2bMsgObj = new B2BMessage();
 b2bMsgObj.setAdapterId(IDataUtil.getString (B2BMsgDocCursor, "adapterId"));
 b2bMsgObj.setBillingCode(IDataUtil.getString (B2BMsgDocCursor, "billingCode")); 
 b2bMsgObj.setCompletionCode(IDataUtil.getString (B2BMsgDocCursor, "completionCode")); 
 b2bMsgObj.setFrom(IDataUtil.getString (B2BMsgDocCursor, "from")); 
 b2bMsgObj.setMode(IDataUtil.getString (B2BMsgDocCursor, "mode")); 
 b2bMsgObj.setPriority(IDataUtil.getString (B2BMsgDocCursor, "priority")); 
 b2bMsgObj.setProtocolString(IDataUtil.getString (B2BMsgDocCursor, "protocolString")); 
 b2bMsgObj.setResponseQueue(IDataUtil.getString (B2BMsgDocCursor, "responseQueue")); 
 b2bMsgObj.setSeqNo(IDataUtil.getString (B2BMsgDocCursor, "seqNo")); 
 b2bMsgObj.setServiceId(IDataUtil.getString (B2BMsgDocCursor, "serviceId")); 
 b2bMsgObj.setServiceType(IDataUtil.getString (B2BMsgDocCursor, "serviceType")); 
 b2bMsgObj.setServiceVersion(IDataUtil.getString (B2BMsgDocCursor, "serviceVersion")); 
 b2bMsgObj.setSessionId(IDataUtil.getString (B2BMsgDocCursor, "sessionId")); 
 b2bMsgObj.setSupportDelay(IDataUtil.getBoolean (B2BMsgDocCursor, " supportDelay")); 
 b2bMsgObj.setTdrId(IDataUtil.getString (B2BMsgDocCursor, "tdrId")); 
 b2bMsgObj.setTimeOut(IDataUtil.getString (B2BMsgDocCursor, "timeOut")); 
 b2bMsgObj.setTimeStamp(IDataUtil.getString (B2BMsgDocCursor, "timeStamp")); 
 b2bMsgObj.setTo(IDataUtil.getString (B2BMsgDocCursor, "to")); 
 b2bMsgObj.setTransactionContext(IDataUtil.getString (B2BMsgDocCursor, "transactionContext")); 
 b2bMsgObj.setTransactionId(IDataUtil.getString (B2BMsgDocCursor, "transactionId")); 
 b2bMsgObj.setTreatmentCode(IDataUtil.getString (B2BMsgDocCursor, "treatmentCode")); 
 b2bMsgObj.setUserId(IDataUtil.getString (B2BMsgDocCursor, "userId"));
        //DEBUG: b2bMsgObj - test about the null value  - This value is being returned!!
        IDataUtil.put(pipelineCursor,"DEBUG", b2bMsgObj.getUserId());
        IDataUtil.put(pipelineCursor,"B2BMessageObject", b2bMsgObj);
catch(Exception e){
IDataUtil.put (pipelineCursor, "error", e.getMessage());
finally {
Do you have more ideas to resolve this problem? 
Thanks !


I have seen cases in which it appears that a custom object is null when viewed in the Developer results panel even though it contains a value.

Try passing your b2bMsgObj object to a test Flow service that reads it from the pipeline and attempts to access one of it’s properties. You might also just add a branch step in the Flow that calls your java service to test for $null.

If the object is truly null after these tests, you might try explicitly casting it to B2BMessage or perhaps Object on your IDataUtil.put like this

 IDataUtil.put(pipelineCursor, "B2BMessageObject", (B2BMessage)b2bMsgObj);




I tried to replicate your problem by using the code you provided and everything worked fine for me. My guess is that your problem does not have to do with the actual Java service but maybe with the service that’s invoking it. Could you be accidentally dropping the B2BMessageObject in the main service? Or could you have accidentally mistyped the variable name B2BMessageObject, for example, in the BRANCH statement?

Also, just a heads up, I noticed that you have a space between " and supportDelay in the following line:
b2bMsgObj.setSupportDelay(IDataUtil.getBoolean (B2BMsgDocCursor, " supportDelay"));

I’m guessing you didn’t actually want that space there.

  • Percio

Hi Mark,
I made the test service, and it works.
The Object is really “null” only on the pipeline, neither the Cast change the “null” value.

Thanks a lot ! :wink:

Hi Percio,

The "null" value that appears on the pipeline is fake ! I did the test that Mark mentioned and a test to

call the javaservice from a Java Application also, and I could work with the result of B2BMessageObject, without problems.
In the “support delay” line, it was reaaly an error, I fixed that…

Thanks a lot ! :slight_smile:

  • Daniela.


Do you mean that the object onliy appears to be null when viewed in the Developer results panel? Your tests confirmed that?


Exactly Mark,

   my tests confirmed that the object is only "null" in the results panel. 
  • Daniela.