on 12-19-2005 10:24 AM
Hello
I m trying to lookup a bean in the Java Mapping.I would like to know about the three options that we get while creating a user defined function in JavaMapping.
In the Context type we get a ResultList parameter.I feel this is the output parameter of function.If i m right, i would like to know how to set the value in this result para.
I tried with the following code:-
<b>result.addValue(<string>);</b>
while testing - Function executes without any error.But the output field is still blank.
Any Idea what i m missing out?
Regards
DhanyaR Nair
Dhanya,
Java mapping has nothing to do with "result.addValue(<string>);"
>>result.addValue(<string>); is something that you use in java function in message mapping and not on java mapping. in java mapping there is nothing link context change of ResultList. All you have is input stream and output stream where you had to parse the xml to produce output stream depending upon the output you need!
I hope you might find my answer helpful.
regards,
Felix
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!!!
Here is a very simple example:
Message 1:
AddValue 1..1
___list 1..unbounded
______value 1..1 xsd:string
Message 2:
DstValue 1..1
___list 1..unbounded
______dstValue 1..1 xsd:string
Message mapping:
list --> list
value --> addValueTest --> dstValue
Function:
public void addValueTest(String[] a, ResultList, Container container) {
___for (int i = 0; i < a.length; i++)
______result.addValue(a<i> + "plus");
}
Test:
Source message:
AddValue
___list
______value "aaa"
___list
______value "bbb"
Target message:
DstValue
___list
______dstValue "aaaplus"
___list
______dstValue "bbbplus"
I hope this will help you.
Regards,
Andrzej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<b>Thanks for the response frndz.
My scenario is to pass two input para to a bean ,which returns the String[][] as output.
I just need to pass these values to result field of user defined function.</b>
<u>Code i used:</u>
public void testQueue(String[] a,String[] b,ResultList result,Container container){
<....bean lookup code...>
String[][] iresult = mapping.getInstance( a[0] , b[0] );
result.addValue(iresult[0][0]);
<b>I m getting Null pointer exception here.
I tried the same code from a simple java client and its giving proper response.
Any idea to resolve this. I m not getting the reason for null pointer exception as
iresult[0][0] gives "<abc>" from java client
and null pointer excep from XI function.
Any idea?
Regards
DhanyaR Nair</b>
Dhanya,
Your bean might end up throwing Nested Exception in XI if it doesn't follow the ejb specifications in WebAs 640. Please check that. Make sure you use try catch in your bean and catch every exception individually and not Exception as a whole!
I am confident this might solve your problem.
regards,
Felix
Hi Felix
Thanks for suggestion.I tried with adding individual catch blocks in the ejb,but still facing the same exception in XI.
I feel if there is any probs with Ejb ,it should reflect the exception while calling from java client too.But here the case is strange.
I m still confused with the null ptr exception.Is there any way to resolve this.If i hard code any string it reflects in the output.
But the value returned from the bean is been reflected as null.How can i test whats the value in iresult.
I tried the trace stmts, but got caught in same Null Ptr excep.Need ur valuable inputs .
Regards
DhanyaR Nair
Hi!!!
You say that your code works perfect outside XI environment. So I suppose there aren't any bugs in coding.
My advise:
Try to find out which part of your code causes an exception. Use try/catch statements.
Check if EVERY object is not null before you invoke any method on it, for example:
if (mapping != null)
___ mapping.method(parameters);
else
throw new RuntimeException("mapping is null");
In this way you will find out where is the problem.
Regards,
Andrzej
Hi!!!
You say that your code works perfect outside XI environment. So I suppose there aren't any bugs in coding.
My advise:
Try to find out which part of your code causes an exception. Use try/catch statements.
Check if EVERY object is not null before you invoke any method on it, for example:
if (mapping != null)
___ mapping.method(parameters);
else
throw new RuntimeException("mapping is null");
In this way you will find out where is the problem.
Regards,
Andrzej
Hi Andrzej
Thats really a nice way to trace exception. I found that the <b>iresult</b> is null i.e
<u>Code:</u>
<i> Object obj = ctx.lookup("MAPPINGLOOKUP");
HomeObj = (CCSMappingLookupHome) obj;
mapping = HomeObj.create();
if ( mapping != null)
{
iresult = mapping.getInstance( a[0] , b[0] );
}
else
throw new RuntimeException("mapping is null");
if ( <b>iresult</b> != null){
result.addValue(<b>iresult</b>[0][0]);}
else
throw new RuntimeException("iresult is null");</i>
But why its not working in XI. Java gives proper response.
Any Other idea?
Thanks In Advance
DhanyaR Nair
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.