private String computeAction(OperationInfo op, String postFix) { StringBuilder s = new StringBuilder(op.getName().getNamespaceURI()); if (s.charAt(s.length() - 1) != '/') { s.append('/'); } s.append(op.getInterface().getName().getLocalPart()) .append('/').append(op.getName().getLocalPart()).append(postFix); return s.toString(); }
bop.getOperationInfo().setUnwrappedOperation(null); if (o.getInput() != null) { final List<MessagePartInfo> messageParts; if (o.getInput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getInput().addMessagePart(o.getName()); inf.setConcreteName(o.getName()); messageParts = o.getInput().getMessageParts(); messageParts = o.getInput().getMessageParts(); if (o.getOutput() != null) { final List<MessagePartInfo> messageParts; if (o.getOutput().getMessagePartsNumber() == 0) { MessagePartInfo inf = o.getOutput().addMessagePart(o.getName()); inf.setConcreteName(new QName(o.getName().getNamespaceURI(), o.getName().getLocalPart() + "Response")); messageParts = o.getOutput().getMessageParts(); messageParts = o.getOutput().getMessageParts(); OperationInfo op = bind.getInterface().getOperation(catchAll); if (op == null) { op = bind.getInterface().addOperation(catchAll); String name = catchAll.getLocalPart(); MessageInfo mInfo = op.createMessage(new QName(catchAll.getNamespaceURI(), name + "Request"), MessageInfo.Type.INPUT); op.setInput(catchAll.getLocalPart() + "Request", mInfo);
private void addInvokeOperation(QName operationName, boolean oneWay) { ServiceInfo info = client.getEndpoint().getEndpointInfo().getService(); OperationInfo invokeOpInfo = info.getInterface() .getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME); OperationInfo opInfo = info.getInterface().addOperation(operationName); opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput()); if (!oneWay) { opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput()); } for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) { BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo); bind.addOperation(bo); } }
private boolean needWrapperClassInterceptor(ServiceInfo serviceInfo) { if (serviceInfo == null) { return false; } for (OperationInfo opInfo : serviceInfo.getInterface().getOperations()) { if (opInfo.isUnwrappedCapable() && opInfo.getProperty(ReflectionServiceFactoryBean.WRAPPERGEN_NEEDED) != null) { return true; } } return false; }
public Set<Class<?>> generate() { for (OperationInfo opInfo : interfaceInfo.getOperations()) { if (opInfo.isUnwrappedCapable()) { Method method = (Method)opInfo.getProperty(ReflectionServiceFactoryBean.METHOD); if (method == null) { continue; MessagePartInfo inf = opInfo.getInput().getFirstMessagePart(); if (inf.getTypeClass() == null) { MessageInfo messageInfo = opInfo.getUnwrappedOperation().getInput(); createWrapperClass(inf, messageInfo, true); MessageInfo messageInfo = opInfo.getUnwrappedOperation().getOutput(); if (messageInfo != null) { inf = opInfo.getOutput().getFirstMessagePart(); if (inf.getTypeClass() == null) { createWrapperClass(inf, messageInfo,
public BindingInfo createBindingInfo(ServiceInfo service, String namespace, Object config) { NMRBindingInfo info = new NMRBindingInfo(service, NMRConstants.NS_NMR_BINDING); info.setName(new QName(service.getName().getNamespaceURI(), service.getName().getLocalPart() + "NMRBinding")); for (OperationInfo op : service.getInterface().getOperations()) { BindingOperationInfo bop = info.buildOperation(op.getName(), op.getInputName(), op.getOutputName()); info.addOperation(bop); } return info; }
@Override public QName getOutPartName(OperationInfo op, Method method, int paramNumber) { method = getDeclaredMethod(method); if (paramNumber >= 0) { return getPartName(op, method, paramNumber, op.getOutput(), "return", false); } WebResult webResult = getWebResult(method); String tns = op.getOutput().getName().getNamespaceURI(); String local = null; if (webResult != null) { if (Boolean.TRUE.equals(isRPC(method)) || isDocumentBare(method)) { local = webResult.partName(); } if (local == null || local.length() == 0) { local = webResult.name(); } } if (local == null || local.length() == 0) { if (Boolean.TRUE.equals(isRPC(method)) || !Boolean.FALSE.equals(isWrapped(method))) { local = "return"; } else { local = getOperationName(op.getInterface(), method).getLocalPart() + "Response"; } } return new QName(tns, local); }
return getParameterName(op, method, paramNumber, op.getOutput().size(), "return", false); QName wrappername = getResponseWrapperName(op, method); if (wrappername != null) { tns = wrappername.getNamespaceURI(); tns = op.getName().getNamespaceURI(); local = getDefaultLocalName(op, method, paramNumber, op.getOutput().size(), "return"); } else { local = getOperationName(op.getInterface(), method).getLocalPart() + "Response";
tns = wrappername.getNamespaceURI(); tns = op.getName().getNamespaceURI(); local = getDefaultLocalName(op, method, paramNumber, partIndex, prefix); } else { local = getOperationName(op.getInterface(), method).getLocalPart(); if (!input) { local += "Response";
private QName getFaultName(WebFault wf, Class<?> cls, OperationInfo op) { String ns = wf.targetNamespace(); if (StringUtils.isEmpty(ns)) { ns = op.getName().getNamespaceURI(); } String name = wf.name(); if (StringUtils.isEmpty(name)) { name = cls.getSimpleName(); } return new QName(ns, name); }
public BindingOperationInfo buildOperation(QName opName, String inName, String outName) { for (OperationInfo op : getInterface().getOperations()) { if (opName.equals(op.getName()) && nameEquals(inName, op.getInputName(), op.getName().getLocalPart() + "Request") && nameEquals(outName, op.getOutputName(), op.getName().getLocalPart() + "Response")) { return new BindingOperationInfo(this, op); } } return null; }
private boolean checkPortTypeOperationFault(BindingFaultInfo bfi) { InterfaceInfo ini = null; if ((bfi.getBindingOperation() != null) && (bfi.getBindingOperation().getOperationInfo() != null)) { ini = bfi.getBindingOperation().getOperationInfo().getInterface(); } return (ini != null) && (ini.getName() != null) && (bfi.getBindingOperation().getName() != null) && (bfi.getFaultInfo().getFaultName() != null) && wsdl11XPointer.matchesPortTypeOperationFault( ini.getName().getNamespaceURI(), ini.getName().getLocalPart(), bfi.getBindingOperation().getName().getLocalPart(), bfi.getFaultInfo().getFaultName().getLocalPart()); }
private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) { for (FaultInfo faultInfo : op.getFaults()) { for (MessagePartInfo mpi : faultInfo.getMessageParts()) { String ns = null; if (mpi.isElement()) { ns = mpi.getElementQName().getNamespaceURI(); } else { ns = mpi.getTypeQName().getNamespaceURI(); } if (qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart()) && qname.getNamespaceURI().equals(ns)) { return mpi; } } } return null; }
LOG.warning(op.getName() + " requires a wrapper bean but problems with" + " ASM has prevented creating one. Operation may not work correctly."); return; QName wrapperElement = messageInfo.getName(); boolean anonymous = factory.getAnonymousWrapperTypes(); + StringUtils.capitalize(op.getName().getLocalPart()); if (!isRequest) { className = className + "Response"; Class<?> def = findClass(pname, method.getDeclaringClass()); if (def == null) { generatePackageInfo(pname, wrapperElement.getNamespaceURI(), method.getDeclaringClass()); av0.visit("name", wrapperElement.getLocalPart()); av0.visit("namespace", wrapperElement.getNamespaceURI()); av0.visitEnd(); mv.visitEnd(); for (MessagePartInfo mpi : messageInfo.getMessageParts()) { generateMessagePart(cw, mpi, method, classFileName); wrapperPart.setTypeClass(clz); wrapperBeans.add(clz);
public void handleMessage(Message message) { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop != null && bop.isUnwrapped()) { XMLStreamWriter xmlWriter = message.getContent(XMLStreamWriter.class); messageInfo = bop.getWrappedOperation().getOperationInfo().getInput(); } else { messageInfo = bop.getWrappedOperation().getOperationInfo().getOutput(); QName name = messageInfo.getFirstMessagePart().getConcreteName(); Service service = message.getExchange().getService(); if (service.getDataBinding().getDeclaredNamespaceMappings() != null) { pfx = service.getDataBinding().getDeclaredNamespaceMappings().get(name.getNamespaceURI()); pfx = StaxUtils.getUniquePrefix(xmlWriter, name.getNamespaceURI(), false); xmlWriter.setPrefix(pfx, name.getNamespaceURI()); xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI()); if (StringUtils.isEmpty(pfx)) {
private void writeWrapper(Message message, BindingOperationInfo bop, XMLStreamWriter xmlWriter) { if (bop.isUnwrapped()) { MessageInfo messageInfo; if (isRequestor(message)) { messageInfo = bop.getWrappedOperation().getOperationInfo().getInput(); } else { messageInfo = bop.getWrappedOperation().getOperationInfo().getOutput(); } MessagePartInfo outPart = messageInfo.getMessageParts().get(0); QName name = outPart.getConcreteName(); try { String pfx = StaxUtils.getUniquePrefix(xmlWriter, name.getNamespaceURI()); xmlWriter.setPrefix(pfx, name.getNamespaceURI()); xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI()); xmlWriter.writeNamespace(pfx, name.getNamespaceURI()); } catch (XMLStreamException e) { throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e); } } }
protected MessagePartInfo getFaultMessagePartInfo(OperationInfo opInfo, QName faultName) { Iterator<FaultInfo> faults = opInfo.getFaults().iterator(); while (faults.hasNext()) { FaultInfo fault = faults.next(); MessagePartInfo partInfo = fault.getMessageParts().get(0); if (partInfo.isElement() && partInfo.getElementQName().getLocalPart().equals(faultName.getLocalPart())) { return partInfo; } else if (partInfo.getTypeQName().getLocalPart().equals(faultName.getLocalPart())) { return partInfo; } } return null; }
private void writerSoapEndpoint(PrintWriter writer, String basePath, AbstractDestination sd) { String absoluteURL = getAbsoluteAddress(basePath, sd); if (absoluteURL == null) { return; } writer.write("<tr><td>"); writer.write("<span class=\"porttypename\">" + sd.getEndpointInfo().getInterface().getName().getLocalPart() + "</span>"); writer.write("<ul>"); for (OperationInfo oi : sd.getEndpointInfo().getInterface().getOperations()) { if (!Boolean.TRUE.equals(oi.getProperty("operation.is.synthetic"))) { writer.write("<li>" + oi.getName().getLocalPart() + "</li>"); } } writer.write("</ul>"); writer.write("</td><td>"); writer.write("<span class=\"field\">Endpoint address:</span> " + "<span class=\"value\">" + absoluteURL + "</span>"); writer.write("<br/><span class=\"field\">WSDL :</span> " + "<a href=\"" + absoluteURL + "?wsdl\">" + sd.getEndpointInfo().getService().getName() + "</a>"); writer.write("<br/><span class=\"field\">Target namespace:</span> " + "<span class=\"value\">" + sd.getEndpointInfo().getService().getTargetNamespace() + "</span>"); addAtomLinkIfNeeded(absoluteURL, atomMap, writer); writer.write("</td></tr>"); }
operation.getInput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, inputAction); operation.getInput().addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, inputAction); if (operation.getOutput() != null) { operation.getOutput().addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, "Response")); operation.getOutput().addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, computeAction(operation, "Response")); MessageInfo input = operation.getInput(); MessageInfo output = operation.getOutput(); if (faultActions != null && faultActions.length > 0 && operation.getFaults() != null) { for (FaultAction faultAction : faultActions) { FaultInfo faultInfo = getFaultInfo(operation, faultAction.className()); if (operation.isUnwrappedCapable()) { faultInfo = getFaultInfo(operation.getUnwrappedOperation(), faultAction.className()); if (faultInfo != null && !StringUtils.isEmpty(faultAction.value())) { faultInfo.addExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME, faultAction for (FaultInfo fi : operation.getFaults()) { if (fi.getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME) == null) { String f = "/Fault/" + fi.getName().getLocalPart(); fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, computeAction(operation, f)); if (operation.isUnwrappedCapable()) {
private static String getWSAAction(BindingOperationInfo boi) { Object o = boi.getOperationInfo().getInput().getProperty(CALCULATED_WSA_ACTION); if (o == null) { o = boi.getOperationInfo().getInput().getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME); if (o == null) { o = boi.getOperationInfo().getInput().getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME); } if (o == null) { String start = getActionBaseUri(boi.getOperationInfo()); if (null == boi.getOperationInfo().getInputName()) { o = addPath(start, boi.getOperationInfo().getName().getLocalPart()); } else { o = addPath(start, boi.getOperationInfo().getInputName()); } } if (o != null) { boi.getOperationInfo().getInput().setProperty(CALCULATED_WSA_ACTION, o); } } return o.toString(); } private static String getActionBaseUri(final OperationInfo operation) {