Hi, I am trying to upload a zip file to Jaggery server using the admin service exposed by the server. Here I am using the https://localhost:9443/admin/services/JaggeryAppAdmin service to upload the zip file.
The request for uploading a file (extracted from WSDL) is like below. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1=" http://mgt.webapp.carbon.wso2.org/xsd"> <soapenv:Header/> <soapenv:Body> <xsd:uploadWebapp> <!--Zero or more repetitions:--> <xsd:webappUploadDataList> <!--Optional:--> <xsd1:dataHandler>cid:1008642448031</xsd1:dataHandler> <!--Optional:--> <xsd1:fileName>test</xsd1:fileName> <!--Optional:--> <xsd1:version>1.0</xsd1:version> </xsd:webappUploadDataList> </xsd:uploadWebapp> </soapenv:Body> </soapenv:Envelope> I am writing a simple jaggery script to achieve this. Here is my Jaggery code. <% var file = new File("app1.zip"); file.open("r"); // print(file.getStream()); // Sending a request to Jaggery-Admin service var ws = require("ws"); var req = new ws.WSRequest(); var options = new Array(); options.useSOAP = 1.2; options.action = "urn:uploadWebapp"; var payload = '<xsd:uploadWebapp xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://mgt.webapp.carbon.wso2.org/xsd"><xsd:webappUploadDataList><xsd1:dataHandler>' + file.getStream() + '</xsd1:dataHandler><xsd1:fileName>' + file.getName() + '</xsd1:fileName><xsd1:version>1.0.0</xsd1:version></xsd:webappUploadDataList></xsd:uploadWebapp>'; var result; try { req.open(options," https://localhost:9443/admin/services/JaggeryAppAdmin", false, "admin", "admin"); req.send(payload); // Get the result result = req; } catch (e) { print(e.toString()); } file.close(); %> This is not working with the above jaggery script. The issue I am facing here is mapping the dataHandler element to the file.getStream() object. Is there any better way to achieve this? Thanks, Chanaka -- -- Chanaka Fernando Technical Lead WSO2, Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 773337238 Blog : http://soatutorials.blogspot.com LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 Twitter:https://twitter.com/chanakaudaya Wordpress:http://chanakaudaya.wordpress.com
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
