return webMethodAnn;
}
private WebResultAnnotation getWebResultAnnotation(Operation operation) {
WebResultAnnotation webResultAnno = null;
Block block;
String resultName = null;
String nsURI = null;
if (operation.getResponse().getBodyBlocks().hasNext()) {
block = operation.getResponse().getBodyBlocks().next();
resultName = block.getName().getLocalPart();
if(isDocStyle || block.getLocation() == Block.HEADER){
nsURI = block.getName().getNamespaceURI();
}
}
for (Parameter parameter : operation.getResponse().getParametersList()) {
if (parameter.getParameterIndex() == -1) {
if(operation.isWrapped()||!isDocStyle){
if(parameter.getBlock().getLocation() == Block.HEADER){
resultName = parameter.getBlock().getName().getLocalPart();
}else{
resultName = parameter.getName();
}
if (isDocStyle || (parameter.getBlock().getLocation() == Block.HEADER)) {
nsURI = parameter.getType().getName().getNamespaceURI();
}
}else if(isDocStyle){
JAXBType t = (JAXBType)parameter.getType();
resultName = t.getName().getLocalPart();
nsURI = t.getName().getNamespaceURI();
}
if(!resultName.equals("return")){
webResultAnno = new WebResultAnnotation();
webResultAnno.setName(resultName);
}
if((nsURI != null) && (!nsURI.equals(serviceNS) || (isDocStyle && operation.isWrapped()))){
if(webResultAnno == null)
webResultAnno = new WebResultAnnotation();
webResultAnno.setTargetNamespace(nsURI);
}
//doclit wrapped could have additional headers
if(!(isDocStyle && operation.isWrapped()) ||
(parameter.getBlock().getLocation() == Block.HEADER)){
if(webResultAnno == null)
webResultAnno = new WebResultAnnotation();
webResultAnno.setPartName(parameter.getName());
}
if(parameter.getBlock().getLocation() == Block.HEADER){
if(webResultAnno == null)
webResultAnno = new WebResultAnnotation();
webResultAnno.setHeader(true);
}
}
}