I have an adapter that returns a record from database. The record contains an integer field, which WM regards as an Object in the resultset. How can I convert this Object to a string, or something that I can work with? Is there a function to convert an Object to something else? Or do I need to write a Java class? Seems like the most basic thing of all, but I can’t find it in documentation or any built in service.
PS…Of course it’s quite easy to create a java class that receives the
Integer and converts it to a string…infact…just one line of code. But I’m just wondering if I’m missing something with webMethods, since I can only imagine every developer me has encountered this issue. Thanks for your insight.
There is a simple way to do this in the Adapter service itself,In the JDBC OutputFieldType change that Integer variable to java.lang.string.
So no manual coding necessary.
and, if you are using old adapter in EI where you cannot convert directly at adapter level (depending upon which database adapter), you have to write that one line of code to convert it manually.
I agree with RMG that it is best to have the adapter service output a string to begin with, but if you can’t do that, there is a package called WmTransformationServices (available for download from advantage utilities and samples section). There are many transformation services in this package, including IntegerToString.