var url = "http://x.x.x.x:50020/servoy-service/rest_ws/backuprestore_ws/ws_backuprestore"
var client = plugins.http.createNewHttpClient();
//Create a new request of specified type.
var request = client.createPostRequest(url);
//Add a file to the post.
request.addFile('test', 'test.txt', 'C:/uploads/test.txt')
var content = "<event>John</event><orgid>Doe</orgid>"
request.setBodyContent(content)
var response = request.executeRequest()
in the web service solution
function ws_create(obj) {
}
how will the the restful web service read get the file that was in the request.addfile? Is the file placed somewhere? or this will only work on ws_read()?
The rest-ws plugin is designed for REST-ful webservices in which the client refers to resources and a POST request send the new data.
In your example a resource could be the file contents as POST body and the url referring to the resource id.
The content type in the http headers would specify the kind of contents (msword file, jpg image, etc), but not a multipart mime type.
Unfortunately, the restws plugin only supports 2 types of content type: json and xml which are sent as parameter to the ws_create() method.
The rest-ws plugin is designed for REST-ful webservices in which the client refers to resources and a POST request send the new data.
In your example a resource could be the file contents as POST body and the url referring to the resource id.
The content type in the http headers would specify the kind of contents (msword file, jpg image, etc), but not a multipart mime type.
Unfortunately, the restws plugin only supports 2 types of content type: json and xml which are sent as parameter to the ws_create() method.
Rob
Thanks Rob. So there is no way to attach the file to the POST request body?