Question
· Jun 17, 2020

How to create a restful service with a link to java code?

Hello everyone,

In the purpose of my work, I have to implement a code that will communicate with a restful server coded in JAVA.

To fulfill my task, they gave me the link to the restful server + a certificate to use + the class that's going to be sent back +  the names of 2 functions:

 

Acces: https://XXX:8443/

First fonction: https://XXX:8443/patient/IdOfPatient

Second fonction: https://XXX:8443/patient/search/nameOfFunction?ndoss=Number

 

Object that returned:

{

"id" = ...

"lastname"=...

...

}

 

How can I use studio to create the link between my studio and the restful server And does a wizard exist to create the method operation like it exist for the SOAP (SOAP wizard)?

The flow is already opened between the two of them.

 

Best Regards,

Thomas

Discussion (1)1
Log in or sign up to continue


var xhttp new XMLHttpRequest();
        xhttp.onreadystatechange function (obj) {
           if (this.readyState == && this.status == 200) {
             window.obj JSON.parse(this.responseText);
              window.obj.Landing.ReplyRoute=xhttpRpl
              window.obj.Landing.Invite=Invite
               AddHostName(window.obj)
            }
        }
Invite=window.location.href.split("=")[1]
route=window.location.href.split("=")[0]
part=route.split("/");
part1=part[0];
part2=part[1];
part3=part[2];
part4=part[3];
//
// http:/ / ip csp
UrlRoute=part1+"/"+part2+"/"+part3+"/"+part4
var xhttpUrl=UrlRoute+"/smartrest/RsvpSpecial?Invite="+Invite
var xhttpRpl=UrlRoute+"/smartrest/RsvpActivity"
         xhttp.open("GET",xhttpUrl, true);
        xhttp.send();
 

There are two issues here

The xhttp is triggered to wait for the traffic to be completed,

xhttp.onreadystatechange function (obj) {
           if (this.readyState == && this.status == 200

There are four changes of state. the 4 means competed. then the Next Fuction can be called to populate the data that has just been uploaded.

The next problem for me. was that the data is out of scope. thus the 'window.obj'

The reply Post:

var ReplyString=JSON.stringify(objReply)
var xhttpRpl=obj.Landing.ReplyRoute
var xhttp new XMLHttpRequest();
xhttp.open("POST",xhttpRpl, true);
xhttp.setRequestHeader('Content-type','application/json; charset=utf-8');
xhttp.onreadystatechangefunction() {
if (this.readyState==='4' && this.status==='200') { return true;}
}
         xhttp.send(ReplyString);
}