I have a custom employee object in the web service as a type. It is defined as a class and returned. I need to consume it in a windows form. The class includes a first name, last name and full name property. I can consume it into a Object type, but can't do anything with it from there. I can't even get the properties out. I have also tried recreating the Employee class in the app and consuming it as a Employee type and it creates an error when building. How do you consume a custom object from a web service?
I found the answer, when you include a web reference or service reference in .net, the custom object is part of the reference. So if you have WebRefernce1, to get to the custom object it is WebRefernce1.customObject. Then to consume a service do a Webreference1.NamespaceOfWebservices.WebMethod. Then consume it into the custom object or custom object array.
Related
We have a custom web service for Acumatica, that we would like to integrate into our extension library. This is a service that accepts data to post into Acumatica (multiple DACs used).
However, I cannot find any information on the proper way to do that.
We use Web API (Api Controller) and route based endpoints, and it is likely that some registration needs to take place when the extension library is loaded.
Any pointers to how this should be done?
b
The following page describes how to get Operation Status with the REST API.
https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx
Is it possible to get that Operation Status with the Microsoft Azure Management Libraries found at https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Libraries ?
Yes. Assuming you have an instance of the ManagementClient class, the method is GetOperationStatus. You pass in the RequestId of the request you want to get the status of.
Also, this method exists for specific resource clients too. For example, the WebSiteManagementClient class exposes this method.
According to my requirement in Liferay, I have created custom fields for roles and assigned it to a user. My goal is to call the JSONWS API and get these custom fields using NodeJS. I am not able to decide which API I should call.
This Url is having APIs: http://www.liferay.com/api/jsonws
I will appreciate for any kind of help.
Regards
AFAIK there is no options to access the expando value via exposed webserveices.
Probably what you can do is that, create a custom portlet, add a dummy entity in the service builder and in that expose a method for web service. In that method call the role API and expando API , and return the result you want.
Custom Fields are called "Expando" in the API and are modeled like virtual tables. The functionality that's exposed through webservices is ExpandoColumn and ExpandoValue. Probably the best way to figure out the parameters to give is to look at the matching database tables. Careful: You should only ever read the database and not be tempted to write to it.
I hate giving the advice to go to the database, but this is probably the quickest - at least for my explanation :)
Finally, I got a genuine solution without hitting database directly. JSONWS is having api :
/portal.expandovalue/get-data
Which helped me to get attributes assigned to a particular role.
The above API needs 5 parameters to be passed.
companyId: whaterver the companyId assigned for your liferay.
className: It depends upon, we created attribute for role or user
com.liferay.portal.model.Role or com.liferay.portal.model.User
tableName: CUSTOM_FIELDS
columnName: It is the same name you given for attribute
classPK: It is nothing but your role or user ID for which you have created Attribute.
In case you are getting "java.lang.NullPointerException" when using #user3771220 solution, try com.liferay.portal.kernel.model.User
I am currently trying to use the Liferay JSON WebService API to access entities (e.g. "Student") from my database. I used ServiceBuilder to build Services for this entity and implemented a method "public Student getStudentByID(long StudentId){...}" in the StudentServiceImpl.
I am also able to see and access this method via "http://sampletest.com/RestTestLiferayProject-portlet/api/jsonws"
How can i invoke this service from another portlet?
my understanding is the json services are intended for use from outside your Liferay instance. From within a portlet you should be able to import your service classes and use them directly.
Apologies if I've misunderstood your question.
The Liferay Security and Permissions docs define a Resource as:
A generic term for any object represented in the portal. Examples of
resources include portlets (e.g. Message Boards, Calendar, etc.), Java
classes (e.g. Message Board Topics, Calendar Events, etc.), and files
(e.g. documents, images, etc.)
As described in another SO post, I'm considering trying to use Liferay's permission system in another application (not a portlet).
In my use case, Liferay resources would be defined for domain objects in my application. When a new domain object is created in my application, I would add a corresponding new resource in Liferay (presumably by using the JSON-WS API).
The docs also state:
The name parameter is the fully qualified Java class name for the
resource object being added. The primKey parameter is the primary key
of the resource object.
Am I undertanding correctly that the 'name parameter' just has to match a<model-name> I've previously defined in a <model-resource>?
And the 'primKey parameter' doesn't have to match any particular object in the Portal database? It could be a primary key of an object in my external database?
So, can a Liferay permissions resource represent an object outside of portal? Am I on the right track?
How you describe it, it should work. Basically the liferay-resource-action definition does it all for you.
But 'name parameter' is not string. Its PK from CLASSNAME_ table, which contains all class names defined in liferay. Here you have to add a line which holds the full qualified java class name.
The 'primarKey' parameter is usually a primary key of some entity form liferay. So maybe you can keep the concept and set you entity pk in the field.