Convert Object to String

Greetings wmusers.

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.

Thanks in advance.

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.

Kayman,

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.

Also check this thread and my comments.

http://www.wmusers.com/wmusers/messages/117/36163.shtml?1087483028

HTH,

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.

HTH.

son of a gun. i’ll be darned. Thanks RMG!

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.