I really was close to solve the problem. The trick was to use interface instead of protocol. I hope that this will be useful for some one:
(ns wstest.core
(:import (javax.jws WebMethod WebService WebParam)
(javax.xml.ws Endpoint)
(wstest.java Person)))
(definterface IFooService
(^int add [^int a ^int b])
(^String sayHi [^String name])
(^wstest.java.Person makePerson [^String firstName ^String lastName])
(^String sayHiTo [^wstest.java.Person person]))
(deftype ^{WebService {:targetNamespace "o.m.g"}} FooService []
IFooService
(^int ^{WebMethod []} add [this ^int #^{WebParam {:name "a"}} a ^int #^{WebParam {:name "b"}} b]
(int (+ a b)))
(^String ^{WebMethod []} sayHi [this ^String #^{WebParam {:name "name"}} name]
(str "Hello, " name "!"))
(^wstest.java.Person ^{WebMethod []} makePerson [this ^String #^{WebParam {:name "firstName"}} firstName ^String #^{WebParam {:name "lastName"}} lastName]
(doto (wstest.java.Person.)
(.setFirstName firstName)
(.setLastName lastName)))
(^String ^{WebMethod []} sayHiTo [this ^wstest.java.Person #^{WebParam {:name "person"}} person]
(str "Hello, " (.getFirstName person) " " (.getLastName person) "!")))
(def endpoint (atom nil))
(do
(if-not (nil? @endpoint)
(.stop @endpoint))
(reset! endpoint (Endpoint/publish "http://localhost:8080/fooService" (FooService.))))
Person.java:
package wstest.java;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Person")
public class Person {
@XmlElement
protected String firstName;
@XmlElement
protected String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String value) {
this.firstName = value;
}
public String getLastName() {
return lastName;
}
public void setLastName(String value) {
this.lastName = value;
}
}