You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@archiva.apache.org by aramirez <ra...@gmail.com> on 2009/01/07 11:03:49 UTC

How to use Archiva Search Service

Hello,

I've seen that archiva 1.2-M1 has now web service interface so I checked out
the codes since no documentation is available yet.

I successfully executed SampleClient in archiva-xmlrpc-client module by
providing these parameters

http://localhost:9091/xmlrpc user pass


Now I tried editing SampleClient cause I'm interested in SearchService and
not AdminstrationService but I got exceptions.

Here's my code:

    public static void main( String[] args )
    {
        Binder binder = new DefaultBinder();
        try
        {
            AuthenticationInfo authnInfo = new AuthenticationInfo( "user",
"pass" );

            SearchService service =
                binder.bind( SearchService.class, new URL(
"http://localhost:9091/xmlrpc" ),
                             authnInfo );

            service.quickSearch( "junit" );

        }
        catch ( Exception e )
        {
            System.out.println( e.getMessage() );
            e.printStackTrace();
        }
    }


And here's the exception:

java.lang.RuntimeException: Could not execute RPC method quickSearch
	at
com.atlassian.xmlrpc.RPCCallMethodInterceptor.invoke(RPCCallMethodInterceptor.java:67)
	at $Proxy4.quickSearch(Unknown Source)
	at org.apache.archiva.web.xmlrpc.client.App.main(App.java:27)
Caused by: org.apache.xmlrpc.XmlRpcException: No such handler:
Search.quickSearch
	at
org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
	at
org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
	at
org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)Could
not execute RPC method quickSearch

	at
org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
	at
org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
	at
com.atlassian.xmlrpc.RPCCallMethodInterceptor.invoke(RPCCallMethodInterceptor.java:62)
	... 2 more


Is the code correct? If not can I ask for a sample code on how to use
SearchService?
-- 
View this message in context: http://www.nabble.com/How-to-use-Archiva-Search-Service-tp21328318p21328318.html
Sent from the archiva-users mailing list archive at Nabble.com.


Re: How to use Archiva Search Service

Posted by Maria Odea Ching <oc...@apache.org>.
Hi Allan,

I made some fixes in the xmlrpc stuff and also added sample code for
invoking the search service in the SampleClient.
You can just uncomment it, then run 'mvn exec:java' in archiva-xmlrpc-client
but make sure that an Archiva instance is
running and that the artifacts you are searching for have been indexed
already in order to get results.

Thanks,
Deng

On Wed, Jan 7, 2009 at 6:03 PM, aramirez <ra...@gmail.com> wrote:

>
> Hello,
>
> I've seen that archiva 1.2-M1 has now web service interface so I checked
> out
> the codes since no documentation is available yet.
>
> I successfully executed SampleClient in archiva-xmlrpc-client module by
> providing these parameters
>
> http://localhost:9091/xmlrpc user pass
>
>
> Now I tried editing SampleClient cause I'm interested in SearchService and
> not AdminstrationService but I got exceptions.
>
> Here's my code:
>
>    public static void main( String[] args )
>    {
>        Binder binder = new DefaultBinder();
>        try
>        {
>            AuthenticationInfo authnInfo = new AuthenticationInfo( "user",
> "pass" );
>
>            SearchService service =
>                binder.bind( SearchService.class, new URL(
> "http://localhost:9091/xmlrpc" ),
>                             authnInfo );
>
>            service.quickSearch( "junit" );
>
>        }
>        catch ( Exception e )
>        {
>            System.out.println( e.getMessage() );
>            e.printStackTrace();
>        }
>    }
>
>
> And here's the exception:
>
> java.lang.RuntimeException: Could not execute RPC method quickSearch
>        at
>
> com.atlassian.xmlrpc.RPCCallMethodInterceptor.invoke(RPCCallMethodInterceptor.java:67)
>        at $Proxy4.quickSearch(Unknown Source)
>        at org.apache.archiva.web.xmlrpc.client.App.main(App.java:27)
> Caused by: org.apache.xmlrpc.XmlRpcException: No such handler:
> Search.quickSearch
>        at
>
> org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
>        at
>
> org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
>        at
>
> org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)Could
> not execute RPC method quickSearch
>
>        at
>
> org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
>        at
>
> org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
>        at
> org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
>        at
> org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
>        at
> org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)
>        at
>
> com.atlassian.xmlrpc.RPCCallMethodInterceptor.invoke(RPCCallMethodInterceptor.java:62)
>        ... 2 more
>
>
> Is the code correct? If not can I ask for a sample code on how to use
> SearchService?
> --
> View this message in context:
> http://www.nabble.com/How-to-use-Archiva-Search-Service-tp21328318p21328318.html
> Sent from the archiva-users mailing list archive at Nabble.com.
>
>


-- 
Maria Odea Ching
Software Engineer | Exist Global | 687-4091 | Skype: maria.odea.ching |
www.exist.com | Innovation Delivered