<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sheila&#039;s Blog &#187; webservice</title>
	<atom:link href="http://sheilapollard.com/tag/webservice/feed/" rel="self" type="application/rss+xml" />
	<link>http://sheilapollard.com</link>
	<description>Software Development</description>
	<lastBuildDate>Wed, 24 Mar 2010 17:19:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Accessing remote Alfresco web services</title>
		<link>http://sheilapollard.com/2009/04/08/accessing-remote-alfresco-web-services/?utm_campaign=feed&utm_medium=feed&utm_source=blog</link>
		<comments>http://sheilapollard.com/2009/04/08/accessing-remote-alfresco-web-services/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 10:38:58 +0000</pubDate>
		<dc:creator>Sheila</dc:creator>
				<category><![CDATA[alfresco]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://sheilapollard.wordpress.com/?p=280</guid>
		<description><![CDATA[You can check that the alfresco webservices are accessible on a remote machine by accessing the url http://hostname:8080/alfresco/api.  You should get the following message.
Axis HTTP Servlet
Hi, you have reached the AXIS HTTP Servlet. Normally you would be hitting this URL with a SOAP client rather than a browser.

In case you are interested, my AXIS transport [...]]]></description>
			<content:encoded><![CDATA[<p>You can check that the alfresco webservices are accessible on a remote machine by accessing the url http://hostname:8080/alfresco/api.  You should get the following message.
<code>Axis HTTP Servlet
Hi, you have reached the AXIS HTTP Servlet. Normally you would be hitting this URL with a SOAP client rather than a browser.

In case you are interested, my AXIS transport name appears to be 'http'</code></p>
<p>To access a remote web service instead of a local one in your code you need to add a file called webserviceclient.properties to the classpath</p>
<p>webserviceclient.properties<code&gt;repository.location=http://hostname:8080/alfresco/api&lt;/code></p>
<p>If you're accessing the web service from your own web application then you need to place webserviceclient.properties in WEB-INF/classes/alfresco/webserviceclient.properties for it to be picked up properly.</p>
<br /><a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQud29yZHByZXNzLmNvbS8/cD0yODAjY29tbWVudHM=" title=\"Comments on &quot;Accessing remote Alfresco web services&quot;\"><img src="http://sheilapollard.com/wp-content/plugins/feed-comments-number/image.php?280" alt="Comments" /></a> <img src="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?view=1&post_id=280" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://sheilapollard.com/2009/04/08/accessing-remote-alfresco-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alfresco &#8211; Create User</title>
		<link>http://sheilapollard.com/2009/04/06/alfresco-create-user/?utm_campaign=feed&utm_medium=feed&utm_source=blog</link>
		<comments>http://sheilapollard.com/2009/04/06/alfresco-create-user/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 14:34:24 +0000</pubDate>
		<dc:creator>Sheila</dc:creator>
				<category><![CDATA[alfresco]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://sheilapollard.wordpress.com/?p=264</guid>
		<description><![CDATA[Creating a new alfresco user using a web service call requires the following jar files in your classpath:
alfresco-web-service-client.jar
axis-1.4.jar
commons-discovery-0.4.jar
commons-logging-1.1.jar
jaxrpc.jar
opensaml-1.1.jar
wsdl4j-1.6.2.jar
wss4j.jar
xmlsec-1.4.1.jar
Create a java class called AlfrescoCreateUser with a main method
public static void main(String[] args) throws Exception {
  AlfrescoCreateUser alfTest = new AlfrescoCreateUser();
  alfTest.createUser();
}
Copy the createPersonProperties method from the AdministrationServiceSystemTest in the web service client code
/**
* Taken [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a new alfresco user using a web service call requires the following jar files in your classpath:
<code>alfresco-web-service-client.jar
axis-1.4.jar
commons-discovery-0.4.jar
commons-logging-1.1.jar
jaxrpc.jar
opensaml-1.1.jar
wsdl4j-1.6.2.jar
wss4j.jar
xmlsec-1.4.1.jar</code></p>
<p>Create a java class called AlfrescoCreateUser with a main method
<code>public static void main(String[] args) throws Exception {
  AlfrescoCreateUser alfTest = new AlfrescoCreateUser();
  alfTest.createUser();
}</code></p>
<p>Copy the createPersonProperties method from the AdministrationServiceSystemTest in the web service client code
<code>/**
* Taken from AdministrationServiceSystemTest in the web service client.
*/
private NamedValue[] createPersonProperties(String homeFolder,
  String firstName,
  String middleName,
  String lastName,
  String email,
  String orgId)

{
   // Create the new user objects
   return new NamedValue[] {
    new NamedValue(Constants.PROP_USER_HOMEFOLDER, false, homeFolder, null),
    new NamedValue(Constants.PROP_USER_FIRSTNAME, false, firstName, null),
    new NamedValue(Constants.PROP_USER_MIDDLENAME, false, middleName, null),
    new NamedValue(Constants.PROP_USER_LASTNAME, false, lastName, null),
    new NamedValue(Constants.PROP_USER_EMAIL, false, email, null),
    new NamedValue(Constants.PROP_USER_ORGID, false, orgId, null)};
}</code></p>
<p>You need to set the user properties and get an authentication token using the admin access details. The code below creates a user called test with a home space also called test under Company Home -&gt; User Homes
<code>/**
* Creates the user test with a home space in Company Home.
*/
public void createUser() {
  String login = "test";
  String password = "password";
  String homeFolder = "://app:company_home/cm:" + login;
  String userName = "test";
  String userMiddlename = "";
  String userSurname = "Test";
  String userEmail = "test";
  String userOrg = "";

    try {
       AuthenticationUtils.startSession("admin", "admin");
      AdministrationServiceSoapBindingStub administrationService = WebServiceFactory.getAdministrationService();
      NewUserDetails newUser = new NewUserDetails(login, password, createPersonProperties(homeFolder, userName,
        userMiddlename, userSurname, userEmail, userOrg));
      administrationService.createUsers(new NewUserDetails[] { newUser });
    }
    catch (AuthenticationFault f) {
      System.out.println("Administration Fault");
      f.printStackTrace();
    }
    catch (RemoteException e) {
      System.out.println("RemoteException");
      e.printStackTrace();
    }
    finally {
      AuthenticationUtils.endSession();&gt;
    }
    System.out.println("User created successfully");
}</code></p>
<p>Run the class and check that the user has been created successfully.</p>
<br /><a href="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3NoZWlsYXBvbGxhcmQud29yZHByZXNzLmNvbS8/cD0yNjQjY29tbWVudHM=" title=\"Comments on &quot;Alfresco &#8211; Create User&quot;\"><img src="http://sheilapollard.com/wp-content/plugins/feed-comments-number/image.php?264" alt="Comments" /></a> <img src="http://sheilapollard.com/wp-content/plugins/feed-statistics.php?view=1&post_id=264" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://sheilapollard.com/2009/04/06/alfresco-create-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
