4 Replies Latest reply: Aug 25, 2010 2:31 AM by 793338 RSS

    Upload zip to the OSB from the API

    793338
      Im trying to upload zip file to the admin server from java code using the API.

      i get an error "cannot create resource outside of the session"

      the upload code:

      ALSBConfigurationMBean alsbSession = ..... (Get the Service...)
      SEssionManagementMBean sessionMgr =.....(Get the Service...)

      String sessionName = "Temp_session";
      Byte[] zipFile = GetTheContent();
      Ref ref = Location();

      sessionMgr.CreateSession(sessionName);
      BulkImportResult result = alsbSession.importZip(ref,zipFile,null);

      And it's not working , the result is failed no exception is thrown

      i checked the before the import method
      alsbSession.GetSessions() and it return null

      how can i create the session to upload the zip ?
        • 1. Re: Upload zip to the OSB from the API
          675595
          http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/javadoc/com/bea/wli/sb/management/configuration/SessionManagementMBean.html
          // obtain session management mbean to create a session.
          // This mbean instance can be used more than once to
          // create/discard/commit many sessions
          SessionManagementMBean sm = (SessionManagementMBean) domainService.
          findService(SessionManagementMBean.NAME,
          SessionManagementMBean.TYPE, null);

          // create a session
          sm.createSession("mysession");
          Manoj
          • 2. Re: Upload zip to the OSB from the API
            793338
            as you can see in my original msg
            i created a session,

            my code:
            SEssionManagementMBean sessionMgr =.....(Get the Service...)
            the Example:
            SessionManagementMBean sm = (SessionManagementMBean) domainService.
            findService(SessionManagementMBean.NAME,
            SessionManagementMBean.TYPE, null);

            it's not working, in need an other type of session
            • 3. Re: Upload zip to the OSB from the API
              675595
              There are no types for session. Can you paste the exception/error you are seeing.

              Manoj
              • 4. Re: Upload zip to the OSB from the API
                793338
                the error is when i see the failed uploaded files (by BulkImportResult.getFailed() method)
                for each file i get the msg : cannot create resource outside of the session