use of com.webcohesion.enunciate.modules.jaxws.model.WebResult in project enunciate by stoicflame.
the class ResponseDocumentQNameMethod method exec.
/**
* Gets the client-side package for the type, type declaration, package, or their string values.
*
* @param list The arguments.
* @return The string value of the client-side package.
*/
public Object exec(List list) throws TemplateModelException {
if (list.size() < 1) {
throw new TemplateModelException("The responseDocumentQName method method must have a web method as a parameter.");
}
TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = FreemarkerUtil.unwrap(from);
if (!(unwrapped instanceof WebMethod)) {
throw new TemplateModelException("A web method must be provided.");
}
WebMethod webMethod = (WebMethod) unwrapped;
if (webMethod.getSoapBindingStyle() != SOAPBinding.Style.DOCUMENT || webMethod.getSoapUse() != SOAPBinding.Use.LITERAL) {
throw new TemplateModelException("No response document qname available for a " + webMethod.getSoapBindingStyle() + "/" + webMethod.getSoapUse() + " web method.");
}
if (webMethod.getResponseWrapper() != null) {
return new QName(webMethod.getResponseWrapper().getElementNamespace(), webMethod.getResponseWrapper().getElementName());
} else if (webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE) {
WebResult wr = webMethod.getWebResult();
if (!wr.isHeader()) {
return new QName(wr.getTargetNamespace(), wr.getElementName());
}
}
return null;
}
Aggregations