use of com.sun.tools.ws.processor.model.jaxb.JAXBType in project metro-jax-ws by eclipse-ee4j.
the class JAXBModelBuilder method getJAXBType.
public JAXBType getJAXBType(QName qname) {
JAXBMapping mapping = jaxbModel.get(qname);
if (mapping == null) {
return null;
}
JavaType javaType = new JavaSimpleType(mapping.getType());
return new JAXBType(qname, javaType, mapping, jaxbModel);
}
use of com.sun.tools.ws.processor.model.jaxb.JAXBType in project metro-jax-ws by eclipse-ee4j.
the class SeiGenerator method writeWebMethod.
private void writeWebMethod(Operation operation, JMethod m) {
Response response = operation.getResponse();
JAnnotationUse webMethodAnn = m.annotate(cm.ref(WebMethod.class));
String operationName = (operation instanceof AsyncOperation) ? ((AsyncOperation) operation).getNormalOperation().getName().getLocalPart() : operation.getName().getLocalPart();
if (!m.name().equals(operationName)) {
webMethodAnn.param("operationName", operationName);
}
if (operation.getSOAPAction() != null && operation.getSOAPAction().length() > 0) {
webMethodAnn.param("action", operation.getSOAPAction());
}
if (operation.getResponse() == null) {
m.annotate(jakarta.jws.Oneway.class);
} else if (!operation.getJavaMethod().getReturnType().getName().equals("void") && operation.getResponse().getParametersList().size() > 0) {
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 (!(operation instanceof AsyncOperation)) {
JAnnotationUse wr = null;
if (!resultName.equals("return")) {
wr = m.annotate(jakarta.jws.WebResult.class);
wr.param("name", resultName);
}
if (nsURI != null || (isDocStyle && operation.isWrapped())) {
if (wr == null) {
wr = m.annotate(jakarta.jws.WebResult.class);
}
wr.param("targetNamespace", nsURI);
}
// doclit wrapped could have additional headers
if (!(isDocStyle && operation.isWrapped()) || (parameter.getBlock().getLocation() == Block.HEADER)) {
if (wr == null) {
wr = m.annotate(jakarta.jws.WebResult.class);
}
wr.param("partName", parameter.getName());
}
if (parameter.getBlock().getLocation() == Block.HEADER) {
if (wr == null) {
wr = m.annotate(jakarta.jws.WebResult.class);
}
wr.param("header", true);
}
}
}
}
}
// DOC/BARE
if (!sameParamStyle) {
if (!operation.isWrapped()) {
JAnnotationUse sb = m.annotate(SOAPBinding.class);
sb.param("parameterStyle", SOAPBinding.ParameterStyle.BARE);
}
}
if (operation.isWrapped() && operation.getStyle().equals(SOAPStyle.DOCUMENT)) {
Block reqBlock = operation.getRequest().getBodyBlocks().next();
JAnnotationUse reqW = m.annotate(jakarta.xml.ws.RequestWrapper.class);
reqW.param("localName", reqBlock.getName().getLocalPart());
reqW.param("targetNamespace", reqBlock.getName().getNamespaceURI());
reqW.param("className", reqBlock.getType().getJavaType().getName());
if (response != null) {
JAnnotationUse resW = m.annotate(jakarta.xml.ws.ResponseWrapper.class);
Block resBlock = response.getBodyBlocks().next();
resW.param("localName", resBlock.getName().getLocalPart());
resW.param("targetNamespace", resBlock.getName().getNamespaceURI());
resW.param("className", resBlock.getType().getJavaType().getName());
}
}
}
Aggregations