Need to write a AutoSys script to invoke a REST service e.g. http://example.com/api/job/test-job and then setup a AutoSys Job.
AutoSys script supports REST service? If yes, will it support only anonymous REST service or it can support secured service as well?
Also, can it record HTTP response code? if yes, can it record HTTP response 200 OK as success and rest as failure when job runs?
There is no such thing as an "Autosys script". Autosys is just a scheduling software, such as crontab is. You cannot create a script with it.
If you can create a script (using bash, ksh, python, perl,...) or a binary file that does the API call you need, then Autosys will be here to start it and give you back the log (if any) and the return code.
See this link - https://support.ca.com/cadocs/0/CA%20Workload%20Automation%20System%20Agent%20r11%203-ENU/Bookshelf_Files/HTML/WebServicesCLIUser_11_3_1/index.htm
CA seems to support an Automation Agent using CLI through which you may invoke HTTP/HTTPS Web Services although there is no information provided on the response codes.
Also if FileWatcher can trigger HTTP requests, then some sort of REST interface to the pertinent web app functionality might work. There does not seem to be any way for AutoSys to directly invoke and record response for a REST service though.
As an alternative you can always interface with the web service using another platform (such as Java) and calling the same via AutoSys.
Related
Im new to Spring Cloud contract. I have written the groovy contract but the wiremock tests are failing. All I see in the console is
org.junit.ComparisonFailure: expected:<[2]00> but was:<[4]00>
Can anyone please guide me how to enable more debugging ad also is there a way to print the request and response sent by wiremock?
I have set the logging.level.com.github.tomakehurst.wiremock=DEBUG in my spring boot app but no luck
If you use one of the latest version of sc-contract, WireMock should print exactly what wasn't matched. You can also read the documentation over here https://cloud.spring.io/spring-cloud-static/Finchley.RELEASE/single/spring-cloud.html#_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client where we answer your questions in more depth. Let me copy that part for you
86.8 How can I debug the request/response being sent by the generated tests client? The generated tests all boil down to RestAssured in some
form or fashion which relies on Apache HttpClient. HttpClient has a
facility called wire logging which logs the entire request and
response to HttpClient. Spring Boot has a logging common application
property for doing this sort of thing, just add this to your
application properties
logging.level.org.apache.http.wire=DEBUG
86.8.1 How can I debug the mapping/request/response being sent by WireMock? Starting from version 1.2.0 we turn on WireMock logging to
info and the WireMock notifier to being verbose. Now you will exactly
know what request was received by WireMock server and which matching
response definition was picked.
To turn off this feature just bump WireMock logging to ERROR
logging.level.com.github.tomakehurst.wiremock=ERROR
86.8.2 How can I see what got registered in the HTTP server stub? You can use the mappingsOutputFolder property on #AutoConfigureStubRunner
or StubRunnerRule to dump all mappings per artifact id. Also the port
at which the given stub server was started will be attached.
86.8.3 Can I reference text from file? Yes! With version 1.2.0 we’ve added such a possibility. It’s enough to call file(…) method in the
DSL and provide a path relative to where the contract lays. If you’re
using YAML just use the bodyFromFile property.
We need to check the technical feasibility to call a Asp.NET web api from korn shell script.
The purpose is to log the start and successful or error end of the script via Web API in a log table. As a bigger picture all the jobs will be using the web API to log the start and end with status. We are creating a Web API to facilitate this.
Can anyone please suggest can this web application be executed or called from Korn shell script. If yes then what command shall be used.
You may use netcat (nc) in order to establish a TCP connection with the web server.
Scenario:
Jenkins is running on a server to which I do not have access to. I cannot use jenkins CLI in this case.
I do have access to the jenkins web interface via a url and I can see the job progress and everything.
There is a build job configured to be run by jenkins. It can be run on an on demand basis using the web interface.
Requirement:
Currently I can specify the parameters defining this external event in the jenkins job web interface and start the job. But it is manual ( I have to do this).
I want to run the job above based on an external event in an automated fashion, which means:
When external event happens start the build specifying the parameters of this external event, wait for build to complete, then if another event happens, repeat.
Question:
Without using jenkins CLI, can I pass the parameters defining the external event to jenkins url as url POST parameters ?
Conclusion:
This way I can monitor the external event and if it happens send its parameters to jenkins url and start a build.
You can start a job by sending a POST to the buildWithParameters endpoint. You can also just string together a query string and GET to that endpoint.
A couple tips:
If your Jenkins instance is secured then you'll want to configure a build trigger token.
If your Jenkins has CSRF protection enabled, any POST needs to include a valid crumb.
See: https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build and https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
Hi I would like to monitor a Java application using the browser but at the same time utilising the existing JMX infrastructure.
I know that JMX provides a HTTP interface but I think it provides a standard web gui and its not possible to mashup its functionality with an existing system.
Are you aware of any REST interface for JMX?
My research on google currently shows that there is one project which does something similar. Is this the only option?
Jolokia is a new (at this time) JMX Agent you can install in your JVM and exposes the MBeanServer over HTTP in JSON format.
Tomcat provides a JMX Proxy Servlet in its Manager Application. I don't think it's exactly REST, but it's stateless and is built from simple HTTP requests, so it should be close enough.
For posterity, I've recently added a little web server to my SimpleJMX package. It exposes beans from the platform MBeanServer to HTTP via Jetty if in the classpath. There is also text versions of all pages that make it easy to scrape.
// create a new JMX server listening on a specific port
JmxServer jmxServer = new JmxServer(8000);
jmxServer.start();
// register any beans to jmx as necessary
jmxServer.register(someObj);
// create a web server publisher listening on a specific port
JmxWebServer jmxWebServer = new JmxWebServer(8080);
jmxWebServer.start();
There's a little test program which shows it in operation. Here's an image of java.lang:type=Memory accessed from a browser. As you can see the output is very basic HTML.
You might want to have a look at jmx4perl. It comes with an agent servlet which proxies REST request to local JMX calls and returns a JSON structure with the answers. It supports read, write, exec, list (list of mbeans) and search operations and knows how to dive into complex data structures via an XPath like expression. Look at the protocol description for more details.
The forthcoming release can deal with bulk (== multiple at once) requests as well and adds the possibility to post a JSON request as alternative to a pure REST GET-request.
In one of the next releases there will support a proxy mode so that no agent servlet needs to be deployed on the target platform, but only on an intermediate, proxy server.
MX4J is another alternative., quoting below from the it's home page -
MX4J is a project to build an Open Source implementation of the Java(TM) Management Extensions (JMX) and of the JMX Remote API (JSR 160) specifications, and to build tools relating to JMX.
Our web services are distributed across different servers for various reasons (such as decreasing latency to the client), and they're not always all up-to-date. Rather than throwing an exception when a method doesn't exist because the particular web service is too old, it would be nicer if we could have the client check if the service responds to a given method before calling it, and otherwise disable the feature (or work around it).
Is there a way to do that?
Get the WSDL (append ?wsdl to the URL) - you can parse that any way you like.
Unit test the web service to ensure its signatures don't break. When you write code that breaks the method signature, you'll know and can adjust the other applications accordingly.
Or just don't break the web services and publish them in a way that enable syou to version them. As in http://services.domain.com/MyService/V1.1/Service.asmx (for .NET) so that way your applications that use v1.1 won't break when you publish v1.2 and make breaking changes.
I would also check out using an internal UDDI server if it's really that big of a hasle to manage your web services. Using the Green Pages of UDDI will tell you what you want to know about the service.
When you are making a SOAP request you are just sending an HTTP request to a server. If the server understands it, it will respond with an HTTP 200 and some XML back, if it doesn't it will send you some error HTTP code (404, 500, ...)
There is no general way to ask for the existance of a "method" exposed by a web service. Try to use the WSDL exposed if it is automatic, or just try to use the "method" and check for an error in the response (you don't have to send an exception to the user...)
Also, I don't know if I understood you well, but you are thinking of quering the server twice, once to check if the method exists, and second to make the actual call it if it does? I would just check for the error if it doesn't, and proceed normally if it does.