protected Object configure(String path, String protocol, String reqtype, String[] rsptypes) {
try {
IBindingFactory fact = BindingDirectory.getFactory(Query.class);
System.out.println("Connecting to service at " + path + " using protocol " + protocol);
Protocol p = ProtocolDirectory.getProtocol(protocol);
MessageOptions options = new MessageOptions();
options.setOutMediaTypeCode(reqtype);
options.setInMediaTypeCodes(rsptypes);
return p.createClient(path, fact, options);
} catch (Exception ex) {
ex.printStackTrace(System.err);
throw new RuntimeException("Error: " + ex.getMessage(), ex);
}
}