Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am receiving image array from SAP using webservice. I am not able to convert that string to image

Web Service Code :

       function String getImageWithStatus () {

            SapSystem system = new SapSystem();
            system.setClient("200");
            system.setHost("*************");
            system.setLanguage("en");
            system.setSystemNumber("02");
            system.setUser("*********");
            system.setPassword("***********");

            properties = new Properties();

            properties.setProperty(DestinationDataProvider.JCO_ASHOST, system.getHost());

            properties.setProperty(DestinationDataProvider.JCO_SYSNR, system.getSystemNumber());
            properties.setProperty(DestinationDataProvider.JCO_CLIENT, system.getClient());
            properties.setProperty(DestinationDataProvider.JCO_USER, system.getUser());
            properties.setProperty(DestinationDataProvider.JCO_PASSWD, system.getPassword());
            properties.setProperty(DestinationDataProvider.JCO_LANG, system.getLanguage());
            System.out.println("******* Connection Parameter Set *******");

            JCoFunction function = repos.getFunction("ZCRM_STATUS_COMPLAINTS_MOB"); 
            function.getImportParameterList().setValue("COMPLAINT_NUM", getcomplaintstatus);
            function.execute(dest);

            MyDestinationDataProvider myProvider = new MyDestinationDataProvider();

            dest = (JCoDestination) JCoDestinationManager.getDestination(SAP_SERVER);

            repos = dest.getRepository();

            byte[] byte_array = null;
            String status = "";
            String result = "";

            if (function.getExportParameterList().getString("FILE_CONTENT_BINARY") != null || !function.getExportParameterList().getString("FILE_CONTENT_BINARY").isEmpty()) {
                byte_array = function.getExportParameterList().getString("FILE_CONTENT_BINARY").getBytes();
                status = function.getExportParameterList().getString("STATUS");

                result = status + "$" + byte_array ;

            } else {
                System.out.println("No Image Found");
            }

             System.out.println("FILE_CONTENT_BINARY :" + byte_array);

      return result ;
  }
share|improve this question
    
maybe there is a specific function to do that - some will answer soon - but you can use imageio if you are in java and that byte array is a legitimate image – gpasch 2 hours ago
    
Which function do you know. I can't use ImageIO as android does not supprot it... – Developer Desk 1 hour ago
    
You've got an array of bytes that might represent some kind of image in some kind of standardized format. Now what exactly is "an image in java" you're trying to create and what have you tried so far? – vwegert 59 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.