[armedbear-devel] java interop question

Kevin Raison raison at chatsubo.net
Thu Oct 14 18:15:04 UTC 2010


Thanks for the pointers, David and Alessio.  I was able to implement my 
HTTP client in abcl with the knowledge that you provided.  As I move on 
to the next phase of my project, I have run into another issue that I 
can't figure out how to solve without coding in java (which I would 
prefer not to do, if I can help it).

The issue is this:  I am trying to build on Apache CXF library, using 
just its simple interface for defining a soap service.  The java pattern 
is like this:

public interface HelloWorld {
   String sayHi(String text);
}

public class HelloWorldImpl implements HelloWorld {
   public String sayHi(String text) {
     return "Hello " + text;
   }
}

import org.apache.cxf.frontend.ServerFactoryBean;

HelloWorldImpl helloWorldImpl = new HelloWorldImpl();
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setServiceClass(HelloWorld.class);
svrFactory.setAddress("http://localhost:9000/Hello");
svrFactory.setServiceBean(helloWorldImpl);
svrFactory.create();

I would like to be able to all of this directly in abcl, meaning code 
the interface, implementation and serverFactory without using java.  I 
don't see a way to do this with abcl.  Several things are unclear to me:

1. I can't find a way to specify an interface in abcl;  if such a thing 
is not possible, all is maybe not lost.  Could I do the interface spec 
in java and the implementation in abcl?
2. CLOS classes don't seem to correspond to java classes, so assuming 
issue #1 is solved, how would I specify an implementation of the 
interface in abcl?
3. As for the serverFactory: if #1 and #2 are solved, the only piece of 
this that isn't clear to me is how to translate

svrFactory.setServiceClass(HelloWorld.class);

to abcl.

Thanks again for the assistance;  if my questions are too junior for 
this list, please don't hesitate to point me somewhere else.

Cheers.
Kevin


On 10/12/2010 02:19 PM, Alessio Stalla wrote:
> On Tue, Oct 12, 2010 at 10:18 PM, David Kirkman<dkirkman at ucsd.edu>  wrote:
>> I don't have httpcomponents, so this is not tested ...
>>
>> But your problem is probably that (jmethod client-class "execute") is
>> looking for a zero argument execute method, and the class does not
>> have one.  Based on the api docs (and your attempted method call), I
>> think you want
>>
>> (jmethod client-class "execute" "org.apache.http.client.methods.HttpUriRequest")
>
> Or if you don't mind paying a certain runtime penalty on each
> invocation, you can use the shorter (jcall "execute" client-obj
> get-obj) and let ABCL figure out the exact method to call.
> Also you can use url directly if it's a Lisp string because ABCL will
> convert it to a Java string automatically when you pass it to a Java
> method.
>
> hth,
> Alessio
>




More information about the armedbear-devel mailing list