cancel
Showing results for 
Search instead for 
Did you mean: 

web service api

mcheng621
Champ in-the-making
Champ in-the-making
I have two questions here:

1. How to use lucene to search a file by name to get a unique return file. I used "TEXT:"filenameSmiley Happy but get an exception (AxisFault).  It appears that it return nothing or ??

2. How to invoke UploadContentServlet in web service program? Do I have to run the program on web server side or I can run from remote client machine has the client web service installed?

Thanks.
4 REPLIES 4

cheffilet
Champ in-the-making
Champ in-the-making
How to use lucene to search a file by name to get a unique return file. I used "TEXT:"filenameSmiley Happy but get an exception (AxisFault). It appears that it return nothing or ??


Query query = new Query();
query.setLanguage(Constants.QUERY_LANG_LUCENE);
query.setStatement("@cm\\:name:\"yourdocument.doc\"");

… repositoryService.query(store, query, false);

How to invoke UploadContentServlet in web service program? Do I have to run the program on web server side or I can run from remote client machine has the client web service installed?
You want to upload a file?

Please review this post how it works: http://forums.alfresco.com/en/viewtopic.php?f=27&t=7346

mcheng621
Champ in-the-making
Champ in-the-making
How to use lucene to search a file by name to get a unique return file. I used "TEXT:"filenameSmiley Happy but get an exception (AxisFault). It appears that it return nothing or ??


Query query = new Query();
query.setLanguage(Constants.QUERY_LANG_LUCENE);
query.setStatement("@cm\\:name:\"yourdocument.doc\"");

… repositoryService.query(store, query, false);
Thanks, yours is working. How to add path before the file name?  Such as
Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:folder1/cm:folder2/……)

How to invoke UploadContentServlet in web service program? Do I have to run the program on web server side or I can run from remote client machine has the client web service installed?
You want to upload a file?

Please review this post how it works: http://forums.alfresco.com/en/viewtopic.php?f=27&t=7346

From the link code, how to control where (which folders) to upload the file?

Also, If I want to use the web service with upload servlet API, where to put the source file to be uploaded? Do I need to put the external  source file inside web server(tomcat) directory? Then which directory? Or could I upload a file from remote client machine? and if so, which folder to put to make it uploaded programmatically by  servlet URL connection call.

Thanks in advance.

cheffilet
Champ in-the-making
Champ in-the-making
Thanks, yours is working. How to add path before the file name? Such as
Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:folder1/cm:folder2/……)

Try following:


parentNode.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, normilizeNodeName( spaceName )));
newNodeProperties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, spaceName )};

CMLCreate cmlCreate= new CMLCreate("1", parentNode, null, null, null, Constants.TYPE_FOLDER, newNodeProperties );
CML createSpaceCML= new CML();
createSpaceCML.setCreate(new CMLCreate[]{cmlCreate});



WebServiceFactory.getRepositoryService().update(cml);



Also, If I want to use the web service with upload servlet API, where to put the source file to be uploaded?

That doesnt matter at all. As long as your Client and Server can communicate which each other you dont have to think about such a manner. The only thing you have to  do is to set up binary upon the the API.

For more informations please have a look to following site: http://wiki.alfresco.com/wiki/IngresTutorial_Alfresco_Web_Service_API_for_Java

mcheng621
Champ in-the-making
Champ in-the-making
Thanks, yours is working. How to add path before the file name? Such as
Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:folder1/cm:folder2/……)

Try following:


parentNode.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, normilizeNodeName( spaceName )));
newNodeProperties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, spaceName )};

CMLCreate cmlCreate= new CMLCreate("1", parentNode, null, null, null, Constants.TYPE_FOLDER, newNodeProperties );
CML createSpaceCML= new CML();
createSpaceCML.setCreate(new CMLCreate[]{cmlCreate});



WebServiceFactory.getRepositoryService().update(cml);


What I meant is that I want to do a search a document, I want to use the full node path in the query statement.  For example:
the statement similar to:
Query query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/cm:space1/cm:space2/cm:GuardFile.txt\"");
But it does not work. how to make a correct query PATH for this example?
Also, If I want to use the web service with upload servlet API, where to put the source file to be uploaded?

That doesnt matter at all. As long as your Client and Server can communicate which each other you dont have to think about such a manner. The only thing you have to  do is to set up binary upon the the API.

For more informations please have a look to following site: http://wiki.alfresco.com/wiki/IngresTutorial_Alfresco_Web_Service_API_for_Java
Thanks, it is very helpful document. By the way how to upload existing PDF file? Will the same read and write function work on PDF format?