...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function spooler_process() { var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/18/" ); spooler_log.info( s); var xmlDOM = new Packages.sos.xml.SOSXMLXPath( new java.lang.StringBuffer( s ) ); spooler_log.info( "Firstname is " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/FIRSTNAME" )); //Creating a person with post com.sos.jitl.restclient.JobSchedulerRestClient.headers.put("Content-Type", "application/xml"); var post = "post(<resource><ID>4711</ID><LASTNAME>world</LASTNAME><FIRSTNAME>Hello</FIRSTNAME></resource>)"; var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand(post, "http://www.thomas-bayer.com/sqlrest/CUSTOMER/" ); //Reading the new entry var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); var xmlDOM = new Packages.sos.xml.SOSXMLXPath( new java.lang.StringBuffer( s ) ); spooler_log.info( "Name is " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/FIRSTNAME" ) + " " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/LASTNAME" )); //Changing the name com.sos.jitl.restclient.JobSchedulerRestClient.headers.put("Content-Type", "application/xml"); var post = "post(<resource><FIRSTNAME>Uwe</FIRSTNAME></resource>)"; var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand(post, "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); //Reading the name var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/18/" ); var xmlDOM = new Packages.sos.xml.SOSXMLXPath( new java.lang.StringBuffer( s ) ); spooler_log.info( "Firstname is " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/FIRSTNAME" )); //Deleting the new entry com.sos.jitl.restclient.JobSchedulerRestClient.headers.put("Content-Type", "application/xml"); var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand("delete", "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); //Reading the deleted entry var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); spooler_log.info( s); //Creating a person with put com.sos.jitl.restclient.JobSchedulerRestClient.headers.put("Content-Type", "application/xml"); var put = "put(<resource><LASTNAME>world</LASTNAME><FIRSTNAME>Hello</FIRSTNAME></resource>)"; var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand(put, "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711" ); //Reading the new entry var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); var xmlDOM = new Packages.sos.xml.SOSXMLXPath( new java.lang.StringBuffer( s ) ); spooler_log.info( "Name is " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/FIRSTNAME" ) + " " + xmlDOM.selectSingleNodeValue( "//CUSTOMER/LASTNAME" )); //Deleting the new entry com.sos.jitl.restclient.JobSchedulerRestClient.headers.put("Content-Type", "application/xml"); var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestServiceCommand("delete", "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); //Reading the deleted entry var s = com.sos.jitl.restclient.JobSchedulerRestClient.executeRestService( "http://www.thomas-bayer.com/sqlrest/CUSTOMER/4711/" ); spooler_log.info( s); return false; } |
References
See also
Change Management References
...