我正在测试来自 SDK 的代码,以在 bitNami Alresco 4.0.e-0 服务器上使用与 Alfresco 位于同一 tomcat 服务器上的 web 应用程序调用 Alfresco。代码在第一次调用 AuthenticationUtils 以获取会话时挂起。我很确定我为此提供了标准的 bitNami Alfresco 用户和密码。我错过了任何图书馆吗?我将大多数可用的依赖项放在我的本地 maven 存储库中,并且代码编译得很好。
以下是没有 Alfresco 许可的 SDK 代码,因为我无法用它格式化代码:
package org.alfresco.sample.webservice;
import org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub;
import org.alfresco.webservice.types.Store;
import org.alfresco.webservice.util.AuthenticationUtils;
import org.alfresco.webservice.util.WebServiceFactory;
public class GetStores extends SamplesBase
{
/**
* Connect to the respository and print out the names of the available
*
* @param args
*/
public static void main(String[] args)
throws Exception
{
// Start the session
AuthenticationUtils.startSession(USERNAME, PASSWORD);
try
{
// Get the respoitory service
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
// Get array of stores available in the repository
Store[] stores = repositoryService.getStores();
if (stores == null)
{
// NOTE: empty array are returned as a null object, this is a issue with the generated web service code.
System.out.println("There are no stores avilable in the repository.");
}
else
{
// Output the names of all the stores available in the repository
System.out.println("The following stores are available in the repository:");
for (Store store : stores)
{
System.out.println(store.getScheme() + "://" + store.getAddress());
}
}
}
finally
{
// End the session
AuthenticationUtils.endSession();
}
}
}