Hi everybody,
I have a question about the libraries. I have a little number of services
using AXIOM but there so many libraries that my application is huge compare
with the little ko for the code.
In fact I develop a Client (GUI Swing application) that use axis2 to call
some services to a server.
My method is quite simple :
public static MainUser getAuthenticatedUser(String login, char[] password)
throws PapoException {
EndpointReference targetEPR = new EndpointReference(baseUrl +
CoreVariables.USER_WEBSERVICE);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("
http://webservices.papo/xsd", "tns");
OMElement method = fac.createOMElement("getAuthenticatedUser",
omNs);
OMElement loginElement = fac.createOMElement("login", omNs);
loginElement.addChild(fac.createOMText(loginElement, login));
method.addChild(loginElement);
OMElement passwordElement = fac.createOMElement("password", omNs);
passwordElement.addChild(fac.createOMText(passwordElement, new
String(password)));
method.addChild(passwordElement);
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
try {
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result = sender.sendReceive(method);
OMElement firstElement = result.getFirstElement();
if(firstElement.getLocalName().equals("message")) {
throw new PapoException(firstElement.getText());
}
else {
loginElement = firstElement;
login = loginElement.getText();
OMElement firstNameElement =
(OMElement)loginElement.getNextOMSibling();
String firstName = firstNameElement.getText();
OMElement lastNameElement =
(OMElement)firstElement.getNextOMSibling();
String lastName = lastNameElement.getText();
OMElement emailElement =
(OMElement)lastNameElement.getNextOMSibling();
String email = emailElement.getText();
MainUser user = new MainUser(login);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setEmail(email);
return user;
}
}
catch (AxisFault af) {
af.printStackTrace();
throw new PapoException("The call to the service has failed !!",
af);
}
}
What are the minimal list of library to make this run. At the moment I put
all the libraries, and try to delete one by one the jar to see what is
needed, but, I still have something like 15 jars... just for this piece of
code :(
At the server side, it is less important but still huge compare with the
code...
--
Michael Bernagou
Java Developper