Page 1 of 1

web services statement search

PostPosted:Tue Oct 05, 2010 7:18 am
by ashishk.kulkarni
i had problem with statement search how to write the code if i am using xpath as string type
please help....

Re: web services statement search

PostPosted:Tue Oct 05, 2010 8:09 am
by pavila
Can you post your code here? Also take a look at http://wiki.openkm.com/index.php/Webservices_Guide.

Re: web services statement search

PostPosted:Tue Oct 05, 2010 10:46 am
by ashishk.kulkarni
Code: Select all
public void statementSearch()
     {
    	 String token=null;
    	  OKMAuthProxy authP=new OKMAuthProxy();
	    	List filePath=new ArrayList();
	    	
    	 try
    	 {
		      
		     token=authP.login("okmAdmin","admin");
		     System.out.println("token"+token);
		     OKMSearchProxy con=new OKMSearchProxy();
		     
		     System.out.println("2");

		     //con.findByContent("token","i");

		     //System.out.println("Object created")
		       //   System.out.println("2");
		    	 
		    
		    	QueryResult [] qR=con.findByStatement(token, txtsearch.getText(),"xpath");
		    	   System.out.println("22");
		    	   alert("before for loop");
		    	for(int j=0;j<qR.length;j++)
		    	{
		    		//alert("Author:"+qR[j].getDocument().getAuthor());
		    		 filePath.add(qR[j].getDocument().getPath());
		    		 
		    	alert("data");
		    		//String f=qR[j].getDocument().toString();
                  		    		
		        }
		    	alert("after for loop");
		    	 ListModel lstsearch=new SimpleListModel(filePath);
		    	 lstSearch.setModel(lstsearch);
		    	System.out.println("3");
		        authP.logout(token);
		     }
    	 catch(Exception e)
    	 {
    		 try
    		 {
    		 authP.logout(token);
    		 }
    		 catch(Exception ex)
    		 {
    			 System.out.println("ex:"+ex);
    		 }
    		 System.out.println("e:"+e);
    	 }
    			 
    	 
     	}
it is not giving any error but how to give xpath i cant understand in text box

Re: web services statement search

PostPosted:Tue Oct 05, 2010 10:13 pm
by pavila
Which XPath query do you try?

Re: web services statement search

PostPosted:Wed Oct 06, 2010 4:22 am
by ashishk.kulkarni
/okm:root/Type1/Category 1/Sub-Category 1
this query should return me all files containing in sub-category 1
but it is not giving me any result

Re: web services statement search

PostPosted:Wed Oct 06, 2010 11:42 am
by ashishk.kulkarni
also tell me how to use find method it is not included in OKMsearchProxy.java so i cant use it

Re: web services statement search

PostPosted:Wed Oct 06, 2010 11:44 am
by ashishk.kulkarni
As in OKMsearch Proxy.java findbyname,findbycontent methods are there and find is not there.But there is give on webservices guide on open km site one more method is given which is find how to use this method.

Re: web services statement search

PostPosted:Sat Oct 09, 2010 7:24 am
by pavila
The XPath query is wrong and should be so:
Code: Select all
/jcr:root/okm:root/Type1/Category 1/Sub-Category 1//element(*, okm:document)

Re: web services statement search

PostPosted:Sat Oct 09, 2010 7:45 am
by ashishk.kulkarni
thank you pavila also tell me about find method please....
really thanx please see it tell me about find..

Re: web services statement search

PostPosted:Sat Oct 09, 2010 7:48 am
by ashishk.kulkarni
pavila xpath query given by you is also not working is my code wrong?
it is not returning me any thing....

Re: web services statement search

PostPosted:Thu Oct 21, 2010 9:03 am
by pavila
Have you tried the same code at http://wiki.openkm.com/index.php/Java_client ? This should work.