Java webservice timeout
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 03:59 AM
Hi,
I am using the sample code to connect to the webservice, but whenever i try to run the program it gives me a connection timeout. I checked the AuthenticationUtils.startSession which internally calls the WebserviceFactory.getEndpointAddress() method. It reads from a property file alfresco/webserviceclient.properties for the url. However, if not found it uses the default address: http://localhost:8080/alfresco/api
When i copy paste the same URL in browser it shows the AXIS page but a timeout when running from java code. Please help.
Thanks
Punit
package com.alfresco.trial;
import org.alfresco.webservice.authentication.AuthenticationFault;
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 AlfrescoSpace {
/**
* @param args
* @throws AuthenticationFault
*/
public static void main(String[] args) {
try
{
AuthenticationUtils.startSession("admin", "admin");
// Get the respoitory service
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService("http://localhost:8080/alfresco/");
// 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());
}
}
AuthenticationUtils.endSession();
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
I am using the sample code to connect to the webservice, but whenever i try to run the program it gives me a connection timeout. I checked the AuthenticationUtils.startSession which internally calls the WebserviceFactory.getEndpointAddress() method. It reads from a property file alfresco/webserviceclient.properties for the url. However, if not found it uses the default address: http://localhost:8080/alfresco/api
When i copy paste the same URL in browser it shows the AXIS page but a timeout when running from java code. Please help.
Thanks
Punit
package com.alfresco.trial;
import org.alfresco.webservice.authentication.AuthenticationFault;
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 AlfrescoSpace {
/**
* @param args
* @throws AuthenticationFault
*/
public static void main(String[] args) {
try
{
AuthenticationUtils.startSession("admin", "admin");
// Get the respoitory service
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService("http://localhost:8080/alfresco/");
// 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());
}
}
AuthenticationUtils.endSession();
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2012 03:52 AM
