Hi All,
I'm facing below error during getUserData via axis transport ws.
HTTP Transport error : '411' - 'Length Required'; nested exception is:
this is little snippet of code being error:
// Instantiate the SOAP proxy. Override the default endpoint so the application ID and the WSSID
// can be added to the URL.
YmwsStub stub = new YmwsStub("http://mail.yahooapis.com/ws/mail/v1.1/soap?appid=" +
URLEncoder.encode(appid, "UTF-8") + "&wssid=" + URLEncoder.encode(authManager.getWssid(), "UTF-8"));
logger.debug("stub: " + stub);
// Axis2 requires you to jump through some hoops to set a cookie on the SOAP proxy. This is the
// only way I have found to get this working. Set up a handler that will take care of injecting
// the cookie into the request.
HandlerDescription description = new HandlerDescription("CookieHandler");
description.setHandler(new CookieHandler(authManager.getCookie()));
PhaseRule rule = new PhaseRule("Security");
description.setRules(rule);
// Add the handler description to the outflow module.
AxisModule module = new AxisModule(new QName("OutFlow"));
module.setOutFlow(new Flow());
module.getOutFlow().addHandler(description);
// Add the outflow module to the Axis configuration.
stub._getServiceClient().getServiceContext().getConfigurationContext().getAxisConfiguration().addModule(module);
stub._getServiceClient().getServiceContext().getConfigurationContext().getAxisConfiguration().engageModule(
new QName("OutFlow"));
// Axis2 throws Exceptions whenever the server returns a SOAP fault. So wrap your
// calls in a try/catch block.
try {
// GetUserData, pulls user preferences and account settings.
logger.debug("start retrieving user data ");
YmwsStub.GetUserData9 getUserData = new YmwsStub.GetUserData9();
getUserData.setGetUserData(new YmwsStub.GetUserData());
YmwsStub.GetUserDataResponse userData = stub.GetUserData(getUserData, null).getGetUserDataResponse();
logger.debug("are you an premium user? " + userData.getData().getUserFeaturePref().getIsPremium());
System.out.println(String.format("Loaded user data for %1$s",
userData.getData().getUserSendPref().getDefaultFromName()));
} catch (AxisFault e) {
// A SOAP fault was thrown by the service.
logger.debug("e.getMessage() = " + e.getMessage());
logger.debug("e " + e.getCause().getMessage());
}
some body could advice me, what does code tobe made the error?
thanks alot.