5 Replies Latest reply: Jun 18, 2014 7:31 AM by 936114 RSS

    OSB java callout function - Cast XmlAnyTypeImpl to String

    rinuthomaz

      I am trying to create a java call out function in OSB(version 11.1.3) to decode the URL. I can use java.net.URLDecoder.decode(data, "UTF-8"); in the program, but OSB function gives below error..


      This error occurs when I pass String and return String


      <Jun 11, 2014 7:43:30 AM UTC> <Error> <OSB Transform> <BEA-382516> <Failed to evaluate expression for callout to java method "public static java.lang.String com.help.test(java.lang.String)". Argument index: 1, exception: Value of type 'org.apache.xmlbeans.impl.values.XmlAnyTypeImpl' cannot be type-cast to 'java.lang.String'>
      <Jun 11, 2014 7:43:35 AM UTC> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it on 10.232.24.59:49,359 during the configured idle timeout of 5 secs>


      From the error : I should both input and return type as XmlAnyTypeImpl . How do I convert String to XmlAnyTypeImpl


      Here is the program which I am trying


      Here is my new program

      import org.apache.xmlbeans.impl.values.XmlAnyTypeImpl;

      public class XMLFormatDecode {

       

      XMLFormatDecode(){

      super(); } 


      public static String getValue(XmlAnyTypeImpl data) {

      String decoded = java.net.URLDecoder.decode(data.toString(), "UTF-8");

      return decoded;

      }  


      public static void main(String[] args) throws UnsupportedEncodingException {

      new XMLFormatDecode();

      System.out.println("Result main - "+XMLFormatDecode.getValue(null));

      }

      }

      will XmlAnyTypeImpl.toString() works ?

       

       

      Can someone help me to convert String to XmlAnyTypeImpl ?