ServiceBuilder and Soap

thumbnail
Dmitry Fengoff, modified 13 Years ago. New Member Posts: 16 Join Date: 3/19/12 Recent Posts
I created service. Basically I want to use it as decorator. I created method:

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
thumbnail
David H Nebinger, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
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...
thumbnail
Dmitry Fengoff, modified 13 Years ago. New Member Posts: 16 Join Date: 3/19/12 Recent Posts
For example in UserServiceSoap there is Soap conversion:

	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?
thumbnail
David H Nebinger, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
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...
thumbnail
Dmitry Fengoff, modified 13 Years ago. New Member Posts: 16 Join Date: 3/19/12 Recent Posts
I think it's a bug. I created issue http://issues.liferay.com/browse/LPS-30190
And I did "pull request".
thumbnail
Hitoshi Ozawa, modified 13 Years ago. Liferay Legend Posts: 7942 Join Date: 3/24/10 Recent Posts
It's not a bug. Should have posted to a new feature request forum instead of creating an issue.