如何将从SAP JCO收到的字节数组转换为java中的图像...?

时间:2016-04-02 17:27:08

标签: java sap

我正在使用webservice从SAP接收图像数组。我无法将该字符串转换为图像

网络服务代码:

       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 ;
  }

0 个答案:

没有答案