Menu
I have an execution of a basic REST machine composed in Java. Every API contact return information in XML format, what should i perform if i needed the file format to be JSON? Perform i need external libraries? Here's my program code:
Consumer.java:
UserDao.coffee
So I have been bashing my head in for a couple days and have searched both AutoIT forums and Thwack Forums for an answer. I understand this could be hard to help sense I cant provide a server for someone to help me test against. I am trying to use the WinHTTP.au3 to connect with Solarwinds Orion.
UserService.java
EDIT: i actually integrated the jackson jars in my project, particularlyjackson-core-2.7.0.jar, jackson-databind-2.7.0.jar, jackson-annotations-2.2.1.jarbut today i obtain this exception from Tomcat:
leqo
leqoleqo
1 Response
I'meters responding to interpreting your question as pertaining to the Sleep program (UserService.coffee), please remark if that is definitely not really what was intended.
You must first ensure that the phone calls in the strategies perform in truth return outcomes as JSON. This will need the suitable modifications to Consumer.coffee and UserDao.coffee to come back JSON rather of XML.
![Api Api](/uploads/1/2/5/8/125822666/735766843.png)
The User class illustration you possess is making use of the Java JAXB library, structured on those observation @XMLRootElement, @XMLElement.
You would require to reword this class making use of a Java library that supports producing JSON objects.
A great choice will be the Jackson library. Here is certainly the house page for Jackson wiki which is pretty well recorded.
Mainly because considerably as the Relaxation service itself will go, in your UserService.java, you would require to alter the mass media type that the program generates.
Switch all instances of technique annotations where you desire to create JSON from
to
paisancopaisanco3,42366 silver badges2222 silver badges3030 bronze badges
Not really the reply you're also looking for? Browse other questions tagged javajsonweb-servicesrest or inquire your own issue.
In the SolarWinds consumer interface, there will be a switch you can click within a change or interface watch to 'Poll Today', instead of waiting for the regularly scheduled poll. I have got been trying to determine out a method to reconstruct this functionality using the SolarWinds API. I've appeared through this page, and it seems like I will need to make use of either the 'invoke' or 'revise' functions, but there is usually almost no information on the real usage. I have also tried examining the Javascript in the user user interface, and can'testosterone levels make minds or tails of it.
I'meters wondering if someone can stage me towards some helpful documentation as to what operations are really accessible in the API (the 'invoke' procedure demands you to provide a 'verb' as an case, but I can't discover any kind of listing or paperwork as to what verbs are accessible). Does anyone understand of any assets?
Tomas Panik2,92522 money badges1818 silver badges2929 bronze badges
TallChuckTallChuck
1 Solution
If you appear at Orion.Nodes SWIS Organization you can notice in the underside 'PollNow' SWIS Verb. Unfortunatelly it is definitely not therefore well recorded what parameters it actually offers (it can become observed in SWQL Recording studio though). But you should be able to perform it this way using Powershell:
Tomas PanikTomas Panik2,92522 yellow metal badges1818 silver precious metal badges2929 bronze badges
![Solarwinds orion api Solarwinds orion api](http://www.purepowershellguy.com/wp-content/uploads/2016/06/Example-Screenshot.png)