Sunteți pe pagina 1din 5

!

"#$%&'(#)%"
I am tiying to expose an inteiface as a web seivice anu access that seivice fiom a
client using only !"#$%#&'(), !"#$*#+,-.#, etc annotations anu the /0,01/23
package that is pait of the stanuaiu }BK.
Ny inteiface will look something like:

@WebService
public interface OrderService {

@WebMethod
public List<Order> getOrders(Exchange exchange);

}


The 56.'078# object, foi the sake of this example, will be a simple enumeiation:
public enum Exchange {
DEBUG_WIDE,
DEBUG_NARROW,
}


The 9+)#+ object foi the sake of this example will be veiy simple:
public class Order {

private int id;
private double price;

public Order(int id, double price) {
this.id = id;
this.price = price;
}

public double getPrice() {
return price;
}

}



I expect to iemote the seivice with something along the lines of:


public class OrderServicePublisher {

public static void main(String[] args) throws IOException {


HttpServer server = HttpServer.create(new
InetSocketAddress(8888), 5);

ExecutorService threads = Executors.newFixedThreadPool(5);

server.setExecutor(threads);
server.start();

Endpoint e = Endpoint.create(new MasterOrderService());
HttpContext context = server.createContext("/os");

e.publish(context);
}

}



Anu I expect to access the seivice with something along the lines of:

public class Test {



public static void main(String[] args)throws MalformedURLException{


Service service = Service.create(
new URL("http://localhost:8888/os?wsdl"),
new QName("http://service.api/", "OrderService"));

OrderService os = service.getPort(OrderService.class);
List<Order> orders = os.getOrders(Exchange.DEBUG_NARROW);

for(Order o : orders) {
System.out.println(o.getPrice());
}
}
}





Ny oiuei seivice implementation woulu look something like this:

@WebService(endpointInterface = "api.service.OrderService",
serviceName = "OrderService")
public class MasterOrderService implements OrderService{

public List<Order> getOrders(Exchange exchange) {

// create some test orders

List<Order> l = new ArrayList<Order>();

l.add(new Order(1, 100.0));
l.add(new Order(2, 105.0));

return l;

}
}

+,- .$%/0-1
The pioblem I'm encounteiing is that with the above appioach the actual uata in the
0iuei object uoes not seem to be getting tiansmitteu. So foi the above example the
"piice" will always be zeio i.e. I suspect the object is not being piopeily seiializeu
anuoi seiializeu.
I woulu like foi someone to get this woiking foi me. Nost impoitant points aie:
a. I want to achieve this using only annotations i.e. I want to avoiu the inteimeuiate
step of geneiating stub files baseu on the wulannotations which I then use to
access the seivice.
b. I'm open to using othei fiamewoiks beyonu what is in the stanuaiu SBK.
c. I woulu expect the solution to woik even if 9+)#+ containeu non-piimitive types
e.g. a List of 9+)#+3
c. This is ieally moie of a test pioject anu I'm looking foi whomevei helps me to
solve it to then help me fuithei uevelop the seivice as pait of anothei pioject to:
i. use SSL enciyption
ii. auu authentication
iii. expanu a set of seivices foi tiauing ciypto cuiiencies which will then be exposeu
as web seivices.
+,- %..%$#'")#2
I expect to have seveial thousanus uollais (at least) of pioject woik foi one talenteu
uevelopei ielateu to --- anu am looking foi someone with the following expeiience:
Familiaiity with BTC anu othei ciypto cuiiencies. Iueally familiaiity with
tiauing them. But if not I woulu expect you to have familiaiity with tiauing
secuiities oi FX e.g. the concept of an "oiuei book" anu uiffeient oiuei types
shoulu not be unfamiliai to you.
Expeiience with Nockito anu a fiim belief in test-uiiven uevelopment
Expeiience with Bibeinate.
Expeiience implementing automateu tiauing stiategies (even if veiy simple)
woulu be iueal.
I woulu expect you fiist to finu a solution to the above pioblem anu woulu also like
to see coue samples of actual coue anu coiiesponuing unit tests you have
implementeu in Nockito. I woulu also like to see some coue samples of woik you
have uoing using hibeinate.
I am both an expeiienceu piogiammei anu tiauei (who is simply too busy with my
uay job as a "managei" anu too olu to uo maiathon piogiamming sessions at night
to wiite the coue I neeu) so you shoulu expect both high stanuaius anu quality
specifications.

S-ar putea să vă placă și