use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSParameter in project cxf by apache.
the class ParameterProcessor method processInput.
private void processInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
if (requireOutOfBandHeader()) {
try {
Class.forName("org.apache.cxf.binding.soap.SoapBindingFactory");
} catch (Exception e) {
LOG.log(Level.WARNING, new Message("SOAP_MISSING", LOG).toString());
}
}
JAXWSBinding mBinding = inputMessage.getOperation().getExtensor(JAXWSBinding.class);
for (MessagePartInfo part : inputMessage.getMessageParts()) {
if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
continue;
}
JavaParameter param = getParameterFromPart(method, part, JavaType.Style.IN);
if (mBinding != null && mBinding.getJaxwsParas() != null) {
for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
if (part.getName().getLocalPart().equals(jwp.getPart())) {
param.setName(jwp.getName());
}
}
}
addParameter(part, method, param);
}
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSParameter in project cxf by apache.
the class WrapperStyleNameCollisionValidator method mapElementName.
private String mapElementName(OperationInfo op, MessageInfo mi, WrapperElement element) {
MessagePartInfo mpi = mi.getMessagePart(element.getElementName());
JAXWSBinding bind = op.getExtensor(JAXWSBinding.class);
if (bind != null && bind.getJaxwsParas() != null) {
for (JAXWSParameter par : bind.getJaxwsParas()) {
if (mi.getName().getLocalPart().equals(par.getMessageName()) && mpi.getName().getLocalPart().equals(par.getElementName().getLocalPart())) {
return par.getName();
}
}
}
return mpi.getElementQName().getLocalPart();
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.customization.JAXWSParameter in project cxf by apache.
the class ParameterProcessor method processOutput.
private void processOutput(JavaMethod method, MessageInfo inputMessage, MessageInfo outputMessage) throws ToolException {
Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
List<MessagePartInfo> outputParts = outputMessage == null ? new ArrayList<>() : outputMessage.getMessageParts();
// figure out output parts that are not present in input parts
List<MessagePartInfo> outParts = new ArrayList<>();
int numHeader = 0;
if (isRequestResponse(method)) {
for (MessagePartInfo outpart : outputParts) {
boolean oob = false;
if (isOutOfBandHeader(outpart)) {
if (!requireOutOfBandHeader()) {
continue;
}
oob = true;
}
MessagePartInfo inpart = inputPartsMap.get(outpart.getName());
if (inpart == null) {
outParts.add(outpart);
if (oob) {
numHeader++;
}
continue;
} else if (isSamePart(inpart, outpart)) {
boolean found = false;
for (JavaParameter p : method.getParameters()) {
if (p.getQName().equals(ProcessorUtil.getElementName(outpart)) && p.getPartName().equals(outpart.getName().getLocalPart())) {
p.setHolder(true);
p.setHolderName(javax.xml.ws.Holder.class.getName());
String holderClass = p.getClassName();
if (JAXBUtils.holderClass(holderClass) != null) {
holderClass = JAXBUtils.holderClass(holderClass).getName();
}
p.setClassName(holderClass);
p.getAnnotations().clear();
p.setStyle(JavaType.Style.INOUT);
p.annotate(new WebParamAnnotator(isOutOfBandHeader(outpart)));
found = true;
}
}
if (!found) {
addParameter(outpart, method, getParameterFromPart(method, outpart, JavaType.Style.INOUT));
}
continue;
} else if (!isSamePart(inpart, outpart)) {
if (oob) {
numHeader++;
}
outParts.add(outpart);
continue;
}
}
}
if (isRequestResponse(method)) {
if (outParts.size() - numHeader == 1 && !isHeader(outParts.get(0))) {
processReturn(method, outParts.get(0));
outParts.remove(0);
} else {
processReturn(method, null);
}
JAXWSBinding mBinding = outputMessage.getOperation().getExtensor(JAXWSBinding.class);
for (MessagePartInfo part : outParts) {
JavaParameter param = getParameterFromPart(method, part, JavaType.Style.OUT);
if (mBinding != null && mBinding.getJaxwsParas() != null) {
for (JAXWSParameter jwp : mBinding.getJaxwsParas()) {
if (part.getName().getLocalPart().equals(jwp.getPart())) {
param.setName(jwp.getName());
}
}
}
addParameter(part, method, param);
}
} else {
processReturn(method, null);
}
}
Aggregations