I am not doing anything special with the request. I am just supposed to receive the request and send it away, and then receive the response and show it to the original sender. I did look into this matter with the help of WRC. We managed to make it work with what Enrico said, using an EnsLib.REST.GenericService and an EnsLib.REST.GenericOperation.
Hello! The response from Robert worked for my purpose! But your solution sounded interesting aswell, I will try it out just for curiosity! :) Thanks for taking the time to respond! :)
Okay! So what finally solved it was a discussion with the WRC support.
Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream. With this said, instead I had to use this code which finally worked:
set profileStream = %request.GetMimeData("profile") set vProfile = profileStream.Read()
However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: set vProfile = $Get(%request.Data("profile")) .
Thanks to WRC and everyone here who tried to help! :)
Okay! So what finally solved it was a discussion with the WRC support.
Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream. With this said, instead I had to use this code which finally worked:
set profileStream = %request.GetMimeData("profile") set vProfile = profileStream.Read()
However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: set vProfile = $Get(%request.Data("profile")) .
Thanks to WRC and everyone here who tried to help! :)
Hello! :) Yes, I did manage to upload a file using similar code. What doesn't work is actually not being able to read strings that are sent via the form-data to my service. The Key that is being sent in the form-data, via postman, is "Profile" and the value of the key is "TEST". So far I can't manage to log the value "TEST". :(
Hello! :) The request that is being sent to my rest-service via postman has one key in the form which is "Profile". The Value of "Profile" is "TEST". But I cannot get my service to log "TEST". By attribute do you mean the Value of the key "Profile"? :)
Hello! I have read it, and tried multiple things but nothing seems to work :( I have tried these already: set vProfile = %request.Get("profile") set vProfile = $Get(%request.Data("profile")) set vProfile = $Get(%request.MimeData("profile")) and set vProfile = %request.GetMimeData("profile")
Hello Ashok! :) Thanks for your answer. I am still having trouble getting the value of the string that is being sent into my webservice. The key is testParam, but it doesn't seem to work as it is now with "Get". Do you have any tips on what to do instead? :)
go to post
Hello!
Thank you for your response! :)
I am not doing anything special with the request. I am just supposed to receive the request and send it away, and then receive the response and show it to the original sender.
I did look into this matter with the help of WRC. We managed to make it work with what Enrico said, using an EnsLib.REST.GenericService and an EnsLib.REST.GenericOperation.
go to post
Hello!
Thanks for the reply! I got it to work finally with the help of WRC! :)
go to post
Hello!
The response from Robert worked for my purpose! But your solution sounded interesting aswell, I will try it out just for curiosity! :) Thanks for taking the time to respond! :)
go to post
Hello!
Thanks alot! It worked flawlessly! :)
go to post
Okay! So what finally solved it was a discussion with the WRC support.
Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream.
With this said, instead I had to use this code which finally worked:
set profileStream = %request.GetMimeData("profile")
set vProfile = profileStream.Read()
However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: set vProfile = $Get(%request.Data("profile")) .
Thanks to WRC and everyone here who tried to help! :)
go to post
Okay! So what finally solved it was a discussion with the WRC support.
Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream.
With this said, instead I had to use this code which finally worked:
set profileStream = %request.GetMimeData("profile")
set vProfile = profileStream.Read()
However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: set vProfile = $Get(%request.Data("profile")) .
Thanks to WRC and everyone here who tried to help! :)
go to post
Hello! :) Yes, I did manage to upload a file using similar code. What doesn't work is actually not being able to read strings that are sent via the form-data to my service. The Key that is being sent in the form-data, via postman, is "Profile" and the value of the key is "TEST". So far I can't manage to log the value "TEST". :(
go to post
Hello! :) The request that is being sent to my rest-service via postman has one key in the form which is "Profile". The Value of "Profile" is "TEST". But I cannot get my service to log "TEST". By attribute do you mean the Value of the key "Profile"? :)
go to post
Hello! It is not an encoded form. :( You might be right about WRC being able to help out!
go to post
But thanks alot for the code example, I really appreciate it! :)
go to post
Hello! It still does not seem to retrieve anything :(. Just an empty string
go to post
It says that %request.ContentType is "multipart/form-data"
go to post
It says that %request.ContentType is "multipart/form-data"
go to post
Hello! My class extends %CSP.REST :)
go to post
yes, I am 100% sure. Don't really know where it has gone wrong.
Double checked postman just to be sure.
go to post
"Profile" is one of the keys in the form. I have tried this: set vProfile = $Get(%request.Data("profile",1), but it only returned an empty value :(
go to post
Hello! Yes I tried that aswell. Still returns an empty value :(
go to post
Hello! I have read it, and tried multiple things but nothing seems to work :(
set vProfile = $Get(%request.Data("profile")) set vProfile = %request.GetMimeData("profile")
I have tried these already:
set vProfile = %request.Get("profile")
set vProfile = $Get(%request.MimeData("profile"))
and
go to post
Hello Ashok! :) Thanks for your answer. I am still having trouble getting the value of the string that is being sent into my webservice. The key is testParam, but it doesn't seem to work as it is now with "Get". Do you have any tips on what to do instead? :)
go to post
I will look into that, thank you! :)