Geonames database works fine for me when to query via WEB. However, there are java packages org.geonames with classes WebService, Toponym and other ones, which seem to do the same from within java application. So, I try to use org.geonames for creating a query like
https://secure.geonames.org/countrySubdivision?lat=47.03&lng=30.2&username=myUserName
which, when sending via WEB, returns xml nwith countryName and adminName1 tags. However, I cannot find appropriate method (methods) in org.geonames returning object with countryName and adminName1 by given latitude and longitude.
How do I solve the problem?
The methods are in the class Toponym, not in the package.
Here is the javadoc with all the methods.
And here is an example from their website.
WebService.setUserName("demo"); // add your username here
ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
searchCriteria.setQ("zurich");
ToponymSearchResult searchResult = WebService.search(searchCriteria);
for (Toponym toponym : searchResult.getToponyms()) {
System.out.println(toponym.getName()+" "+ toponym.getCountryName());
}
Related
I have integrated the XERO-API on my java application and I need to display a list of Assets along with their AssetType.
I have seen that when you make a Postman call to get all Assets, the JSON object items returned contain the "assetTypeId" attribute as well as in the API documentation the "assetTypeId" attribute is returned.
However the Asset.class from the java sdk does not contain the "assetTypeId" property. Is there another way to get the AssetType from an Asset using the xero-api java sdk? I am using v3.5.2 of the jar.
that field should be serialized back based on the model definition. Can you post back what you are receiving from the SDK
public class AssetType {
#JsonProperty("assetTypeId")
private UUID assetTypeId;
#JsonProperty("assetTypeName")
private String assetTypeName;
... etc
Source
https://github.com/XeroAPI/Xero-Java/blob/master/src/main/java/com/xero/models/assets/AssetType.java#L33
Let me know what is being returned and we try to see why thats not being serialized back.
I've connected my Java application to Ontology using OWL API, connection and retrieving classes worked very well.
Now, I'm trying to get the class, to which an individual belongs.
OWLNamedIndividual ind = factory.getOWLNamedIndividual(":myIndTest", pm);
I'm trying to find the class of an individual (inputted from user) , and then perform my action.
How can I get the class (direct class) for this individual?
Thanks in advance, Regards
After some research in the OWL API docs, I've tried :
System.out.println("Class: " + ind.getTypes(ontology).toString());
and it works.
Including, the individual is available in one class only, and cant be found in more than one.
Regards
I'm currently on a project that involves OpenText Content Server 10.5 SP1 Update 2015-03.
I'm trying to find out if is possible to get all categories from the System Category Volume with one call using Java SOAP web services or REST.
On the web services side I found a couple of methods exposed by the DocumentManagement WSDL GetCategoryDefinition and GetCategoryDefinitions which require categoryIDs as argument.
On the REST side I managed to obtain access to categories but after a quite long trip:
call to otcs/cs.exe?func=search.GetCategoryVolume gives as a response an URL for the subsequent call
call to otcs/cs.exe?func=ll&ObjID=2005&objAction=XMLExport&scope=1 gives the id of the system category volume along with category IDs
call to otcs/cs.exe?func=ll&ObjID=21361&objAction=XMLExport&scope=1 gives the required info about the category.
I would like to have a single call returning all information about categories I need.
Is it possible to achieve that?
It's possible.
What you need to do:
1.) Find all IDs of the Categories, you want the definitions for
2.) call DocumentManagementWS.getCategoryDefinitions(IDs)
example
In my project we store all Categories in Folders, and not in the CategoryVolume of Content server.
// INFO: variable dm is an instance of the documentManagement-Webservice
// 1.) read the folder of the Categories
Node categoryRoot = dm.getNodeByPath(configRoot.getID(), Arrays.asList("Categories"));
// 2.) find all Ids of the categories
List<Node> categories = dm.listNodes(categoryRoot.getID(), false);
if (categories != null) {
for (Node category : categories) {
if (category.getType().equals("Category")) {
categoryIds.add(category.getID());
}
}
}
// 3.) Read all defintitions of the categories
List<AttributeGroupDefinition> categoryDefinitions = dm.getCategoryDefinitions(categoryIds);
Maybe not exactly program oriented but you know about the handler "cs.exe?func=attributes.dump" ? This is the UI version of what you are asking.
I am using LinkedIn-J. My application authenticates without problem, I get data from the user - even their first name, last name etc.
Person profile = client.getProfileForCurrentUser();
profile.getFirstName();
However, when I try to get the list of educations, the Educations object returned is null:
Educations educations = profile.getEducations();
educations == null
What can be the error? Should my application ask for special permissions to be granted?
I've never used the Linkedin-j api before, but according to the LinkedIn api you get firstname, lastname, headline, and some url by default.
So I believe you need to specify that you want education returned. I don't know how to do that in LinkedIn-J though.
http://developer.linkedin.com/documents/profile-api
For example, with the rest api you'd use this uri:
http://api.linkedin.com/v1/people/id=12345:(first-name,last-name, educations)
Using the LinkedIn J library, it seems like you have to add profile fields using Set as a parameter to one of their many methods in the client.
Example of a method you could call of many (if you have a connected user):
public Person getProfileForCurrentUser(Set<ProfileField> profileFields)
ProfileField is an Enum located here:
import com.google.code.linkedinapi.client.enumeration.ProfileField;
I'm very new in using web services. Appreciate if anyone can help me on this.
In my PHP codes, I'm trying to use the SOAP web services from another server (JIRA, java). The JIRA SOAP API is shown here.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "issuekey");
I found that my codes have no problem to call the functions listed on that page. However, I don't know how to use the objects returned by the API calls.
My question are:
In my PHP codes, how can I use the methods in the Java class objects returned by SOAP API calls?
For example, the function $remoteissue = $jirasoap->getIssue($a, $b) will return a RemoteIssue. Based on this (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), there are methods like getSummary, getKey, etc. How can I use these functions in my codes?
Based on some PHP examples I found from the internet, it seems that everyone is using something like this:
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$key = $remoteissue->key;
They are not using the object's methods.
Refer to this example, it seems that someone is able to do this in other languages. Can it be done in PHP too?
The problem I'm facing is that, I am trying to get the ID of an Attachment. However, it seems that we can't get the Attachment ID using this method: $attachmentid = $remoteattachment->id;. I am trying to use the $remoteattachment->getId() method.
In PHP codes, after we made a SOAP API call and received the returned objects, how do we know what data fields are available in that object?
For example,
$remoteissue = $jirasoap->getIssue($token, "issuekey");
$summary = $remoteissue->summary;
How do we know ->summary is available in $remoteissue?
When i refer to this document (http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/beans/RemoteIssue.html), I don't see it mention any data fields in RemoteIssue. How do we know we can get key, summary, etc, from this object? How do we know it is ->summary, not ->getsummary? We need to use a web browser to open the WSDL URL?
Thanks.
This question is over one year old, but to share knowledge and provide an answer to people who have this same question and found this page, here are my findings.
The document mentioned in the question is an overview of the JiraSoapService interface. This is a good reference for what functions can be called with which arguments and what they return.
If you use Java for your Jira SoapClient the returned objects are implemented, but if you use PHP, the returned objects aren't of the type stated in this documentation and do not have any of the methods mentioned. The returned objects are instances of the internal PHP class stdClass, which is a placeholder for undefined objects. The best way to know what is returned is to use var_dump() on the objects returned from the SoapCalls.
$jirasoap = new SoapClient($jiraserver['url']);
$token = $jirasoap->login($jiraserver['username'], $jiraserver['password']);
$remoteissue = $jirasoap->getIssue($token, "PROJ-1");
var_dump($remoteissue);
/* -- You will get something like this ---
object(stdClass)#2 (21) {
["id"]=> string(3) "100"
["affectsVersions"]=> array(0) { }
["assignee"]=> string(4) "user"
...
["created"]=> string(24) "2012-12-13T09:27:49.934Z"
...
["description"]=> string(17) "issue description"
....
["key"]=> string(6) "PROJ-1"
["priority"]=> string(1) "3"
["project"]=> string(4) "PROJ"
["reporter"]=> string(4) "user"
["resolution"]=> NULL
["status"]=> string(1) "1"
["summary"]=> string(15) "Project issue 1"
["type"]=> string(1) "3"
["updated"]=> string(24) "2013-01-21T16:11:43.073Z"
["votes"]=> int(0)
}
*/
// You can access data like this:
$jiraKey = $remoteissue->key;
$jiraProject = $remoteissue->project;
The document you referred to in #2 is to a Java implementation and really doesn't give you any help with PHP. If they do not publish a public API for their service (which would be unusual), then using the WSDL as a reference will let you know what objects and methods are accepted by the service and you can plan your method calls accordingly.
The technique you used to call getIssue(...) seems fine, although you should consider using try...catch in case of a SoapException.
I have used Jira SOAP in .NET project and IntelliSense hinted me what fields are available for returned object.
You can use something like VS.Php for Visual Studio or Php for Visual Studio if you are using Visual Studio.
Or you can choose one of the IDEs from here with support of IntelliSense.