Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
ServiceBuilder and Soap
I created service. Basically I want to use it as decorator. I created method:
when i exec "build-service" task it generates method in *Soap.class:
But I need something like this:
So, if I change all returns to "toSoapModel" it'll changed back when I exec "build-service" again. How i can solve it? Do i need change template in service builder sources?
I use Liferay 6.1 ce
public DLFolder getFolder(long groupId, long parentFolderId, String name) throws PortalException, SystemException {
return DLFolderServiceUtil.getFolder(groupId, parentFolderId, name);
}
when i exec "build-service" task it generates method in *Soap.class:
public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
long groupId, long parentFolderId, java.lang.String name)
throws RemoteException {
try {
com.liferay.portlet.documentlibrary.model.DLFolder returnValue = FCWebApiServiceUtil.getFolder(groupId,
parentFolderId, name);
return returnValue;
}
catch (Exception e) {
_log.error(e, e);
throw new RemoteException(e.getMessage());
}
}
But I need something like this:
public static DLFolderSoap getFolder(
long groupId, long parentFolderId, java.lang.String name)
throws RemoteException {
try {
com.liferay.portlet.documentlibrary.model.DLFolder returnValue = FCWebApiServiceUtil.getFolder(groupId,
parentFolderId, name);
return DLFolderSoap.toSoapModel(returnValue);
}
catch (Exception e) {
_log.error(e, e);
throw new RemoteException(e.getMessage());
}
}
So, if I change all returns to "toSoapModel" it'll changed back when I exec "build-service" again. How i can solve it? Do i need change template in service builder sources?
I use Liferay 6.1 ce
I believe the soap translation is to be automatic, in that you make the call in your client code and the framework ensures it is correctly translated to the soap form when it is returned...
For example in UserServiceSoap there is Soap conversion:
Is it doing that automatically?
public static com.liferay.portal.model.UserSoap getUserByEmailAddress(
long companyId, java.lang.String emailAddress)
throws RemoteException {
try {
com.liferay.portal.model.User returnValue = UserServiceUtil.getUserByEmailAddress(companyId,
emailAddress);
return com.liferay.portal.model.UserSoap.toSoapModel(returnValue);
}
catch (Exception e) {
_log.error(e, e);
throw new RemoteException(e.getMessage());
}
}
Is it doing that automatically?
Certainly. Any method that you add to XxxServiceImpl will result in the soap wrapper and the corresponding soap conversion in XxxServiceSoap.
This is again the magic of using Service Builder...
This is again the magic of using Service Builder...
I think it's a bug. I created issue http://issues.liferay.com/browse/LPS-30190
And I did "pull request".
And I did "pull request".
It's not a bug. Should have posted to a new feature request forum instead of creating an issue.