For some time ago I used [1] to upload a capp written by aruna. You can use that.
[1] https://github.com/arunasujith/capp-upload-admin-service-sample Thanks On Tue, Nov 24, 2015 at 2:17 PM, Lakshman Udayakantha <lakshm...@wso2.com> wrote: > what is the error? > > On Tue, Nov 24, 2015 at 2:11 PM, Rukshan Premathunga <ruks...@wso2.com> > wrote: > >> Hi, >> >> I was trying to deploy carbon-app (.car file) using java client. For that >> i used the *CarbonAppUploader *service. >> >> Below the code i used to deploy the capp and it is worked fine. >> >> >> File file = new File(cAppPath); >> >> >> //get the byte array of file >> >> byte[] byteArray = FileUtils.readFileToByteArray(file); >> >> DataHandler dataHandler = new DataHandler(byteArray, >> >> APIUsageStatisticsClientConstants.APPLICATION_OCTET_STREAM); >> >> >> //create the stub to deploy artifacts >> >> CarbonAppUploaderStub stub = new CarbonAppUploaderStub(url + >> "/services/CarbonAppUploader"); >> >> ServiceClient client = stub._getServiceClient(); >> >> Options options = client.getOptions(); >> >> //set the security >> >> HttpTransportProperties.Authenticator authenticator = new >> HttpTransportProperties.Authenticator(); >> >> authenticator.setUsername(user); >> >> authenticator.setPassword(pass); >> >> authenticator.setPreemptiveAuthentication(true); >> >> options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, >> authenticator); >> >> client.setOptions(options); >> >> log.info("Deploying DAS cApp '" + cAppName + "'..."); >> >> >> //create UploadedFileItem array and 1st element contain the deploy >> artifact >> >> UploadedFileItem[] fileItem = new UploadedFileItem[1]; >> >> fileItem[0] = new UploadedFileItem(); >> >> fileItem[0].setDataHandler(dataHandler); >> >> fileItem[0].setFileName(cAppName); >> >> *fileItem[0].setFileType("jar");* >> >> >> //upload the artifacts >> >> stub.uploadApp(fileItem); >> >> >> But for the capp file type i always have to set "jar". I tried with the >> "car" but gave me an error. >> So do we have any other correct way to deploy Capp. Or is this behavior >> is a bug? >> >> Thanks and Regards. >> >> Rukshan Chathuranga. >> Software Engineer. >> WSO2, Inc. >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Lakshman Udayakantha > WSO2 Inc. www.wso2.com > lean.enterprise.middleware > Mobile: *0714388124* > > -- Lakshman Udayakantha WSO2 Inc. www.wso2.com lean.enterprise.middleware Mobile: *0714388124*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev