QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke"); 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(); bop.getInput().setMessageParts(messageParts); } else { messageParts = o.getInput().getMessageParts(); 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(); bop.getOutput().setMessageParts(messageParts); } else { messageParts = o.getOutput().getMessageParts(); MessagePartInfo mpi = mInfo.addMessagePart("parameters"); mpi = mInfo.addMessagePart("parameters");
@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); }
private void addSoapBodyPart(MessageInfo msg, List<MessagePartInfo> bodyParts, String partName) { MessagePartInfo mpi = msg.getMessagePart(new QName(msg.getName().getNamespaceURI(), partName)); bodyParts.add(mpi); }
SoapOperationInfo soi = bop.getExtensor(SoapOperationInfo.class); if (soi != null) { if ("document".equals(operationStyle)) { if (bop.getOperationInfo().getInput() != null && bop.getOperationInfo().getInput().getMessagePartsNumber() > 0) { QName qn = bop.getOperationInfo().getInput().getMessagePartByIndex(0) .getElementQName(); QName op = bop.getOperationInfo().getName(); if (reverseMapping) { payloadElementMap.put(op.toString(), qn); } else { payloadElementMap.put(qn.toString(), op); QName op = bop.getOperationInfo().getName(); payloadElementMap.put(op.toString(), op);
if (messageInfo == null || bop == null || !bop.isUnwrapped()) { return; BindingOperationInfo newbop = bop.getWrappedOperation(); MessageInfo wrappedMsgInfo; if (Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) { wrappedMsgInfo = newbop.getInput().getMessageInfo(); } else { wrappedMsgInfo = newbop.getOutput().getMessageInfo(); if (wrappedMsgInfo.getMessagePartsNumber() > 0) { wrapped = wrappedMsgInfo.getFirstMessagePart().getTypeClass(); MessagePartInfo firstMessagePart = wrappedMsgInfo.getFirstMessagePart(); MessageContentsList objs = MessageContentsList.getContentsList(message); WrapperHelper helper = firstMessagePart.getProperty("WRAPPER_CLASS", WrapperHelper.class); if (helper == null) { helper = getWrapperHelper(message, messageInfo, wrappedMsgInfo, wrapped, firstMessagePart); newObjs.put(firstMessagePart, o2); for (MessagePartInfo p : messageInfo.getMessageParts()) { if (Boolean.TRUE.equals(p.getProperty(ReflectionServiceFactoryBean.HEADER))) { MessagePartInfo mpi = wrappedMsgInfo.getMessagePart(p.getName()); if (objs.hasValue(p)) { newObjs.put(mpi, objs.get(p));
op.setProperty(METHOD, method); MessageInfo inMsg = op.createMessage(this.getInputMessageName(op, method), MessageInfo.Type.INPUT); op.setInput(inMsg.getName().getLocalPart(), inMsg); final Annotation[][] parAnnotations = method.getParameterAnnotations(); final Type[] genParTypes = method.getGenericParameterTypes(); QName partName = getInPartName(op, method, j); if (!isRPC(method) && !isWrapped(method) && inMsg.getMessagePartsMap().containsKey(partName)) { LOG.log(Level.WARNING, "INVALID_BARE_METHOD", getServiceClass() + "." + method.getName()); partName = new QName(partName.getNamespaceURI(), partName.getLocalPart() + j); MessagePartInfo part = inMsg.addMessagePart(partName); op.setOutput(outMsg.getName().getLocalPart(), outMsg); final Class<?> returnType = method.getReturnType(); if (!returnType.isAssignableFrom(void.class)) { final QName q = getOutPartName(op, method, -1); final QName q2 = getOutParameterName(op, method, -1); MessagePartInfo part = outMsg.addMessagePart(q); initializeParameter(part, method.getReturnType(), method.getGenericReturnType()); if (!isRPC(method) && !isWrapped(method)) { q = op.getInput().getMessagePartByIndex(j).getName(); q2 = (QName)op.getInput().getMessagePartByIndex(j).getProperty(ELEMENT_NAME); if (q2 == null) { q2 = op.getInput().getMessagePartByIndex(j).getElementQName(); MessagePartInfo part = outMsg.addMessagePart(q);
+ msg.getQName().getLocalPart() + " does not specify a name."); QName pqname = new QName(minfo.getName().getNamespaceURI(), part.getName()); MessagePartInfo pi = minfo.getMessagePart(pqname); if (pi != null && pi.getMessageInfo().getName().equals(msg.getQName())) { continue; pi = minfo.addOutOfBandMessagePart(pqname); if (!minfo.getName().equals(msg.getQName())) { pi.setMessageContainer(new MessageInfo(minfo.getOperation(), null, msg.getQName())); pi.setTypeQName(part.getTypeName()); pi.setElement(false); pi.setXmlSchema(schemas.getTypeByQName(part.getTypeName()));
protected BindingOperationInfo findOperation(String suffix) { BindingInfo bi = client.getEndpoint().getBinding().getBindingInfo(); for (BindingOperationInfo boi : bi.getOperations()) { SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class); String soapAction = soi != null ? soi.getAction() : null; Object o = boi.getOperationInfo().getInput() .getExtensionAttribute(new QName("http://www.w3.org/2007/05/addressing/metadata", "Action")); if (o instanceof QName) { o = ((QName)o).getLocalPart(); if (suffix.endsWith(boi.getName().getLocalPart())) { return boi; if (boi.getInput().getMessageInfo().getMessagePartsNumber() > 0) { MessagePartInfo mpi = boi.getInput().getMessageInfo().getFirstMessagePart(); if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) { return boi;
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); } } }
private static OperationInfo addCancelOperation(InterfaceInfo ii, String namespace, String servNamespace) { OperationInfo oi = ii.addOperation(new QName(servNamespace, "CancelSecurityToken")); MessageInfo mii = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenMsg"), MessageInfo.Type.INPUT); oi.setInput("CancelSecurityTokenMsg", mii); MessagePartInfo mpi = mii.addMessagePart("request"); mpi.setElementQName(new QName(namespace, "RequestSecurityToken")); MessageInfo mio = oi.createMessage(new QName(servNamespace, "CancelSecurityTokenResponseMsg"), MessageInfo.Type.OUTPUT); oi.setOutput("CancelSecurityTokenResponseMsg", mio); mpi = mio.addMessagePart("response"); if (WST_NS_05_02.equals(namespace)) { mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponse")); } else { mpi.setElementQName(new QName(namespace, "RequestSecurityTokenResponseCollection")); } return oi; }
protected void buildBindingInput(Definition def, BindingOperation bindingOperation, BindingMessageInfo bindingMessageInfo) { BindingInput bindingInput = null; if (bindingMessageInfo != null) { bindingInput = def.createBindingInput(); addDocumentation(bindingInput, bindingMessageInfo.getDocumentation()); bindingInput.setName(bindingMessageInfo.getMessageInfo().getName().getLocalPart()); bindingOperation.setBindingInput(bindingInput); addExtensibilityAttributes(def, bindingInput, bindingMessageInfo.getExtensionAttributes()); addExtensibilityElements(def, bindingInput, getWSDL11Extensors(bindingMessageInfo)); } }
private boolean checkBindingOperationInOut(BindingMessageInfo bmi) { if ((bmi.getMessageInfo() != null) && (bmi.getMessageInfo().getName() != null) && (bmi.getBindingOperation() != null) && (bmi.getBindingOperation().getName() != null) && (bmi.getBindingOperation().getBinding() != null) && (bmi.getBindingOperation().getBinding().getName() != null)) { if ((Type.INPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesBindingOperationInput( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getBindingOperation().getBinding().getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } if ((Type.OUTPUT == bmi.getMessageInfo().getType()) && wsdl11XPointer.matchesBindingOperationOutput( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getBindingOperation().getBinding().getName().getLocalPart(), bmi.getBindingOperation().getName().getLocalPart())) { return true; } } return false; }
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(); int count = 0; while (def != null) { Boolean b = messageInfo.getProperty("parameterized", Boolean.class); if (b != null && b) { className = origClassName + (++count); def = findClass(className, method.getDeclaringClass()); } else { wrapperPart.setTypeClass(def); wrapperBeans.add(def); return; mv.visitEnd(); for (MessagePartInfo mpi : messageInfo.getMessageParts()) { generateMessagePart(cw, mpi, method, classFileName); wrapperPart.setTypeClass(clz); wrapperBeans.add(clz);
private void createMessagePartInfo(OperationInfo oi, Class<?> type, QName qname, Method m, boolean input) { if (type == void.class || Source.class.isAssignableFrom(type)) { return; } if (InjectionUtils.isPrimitive(type) || Response.class == type) { return; } QName mName = new QName(qname.getNamespaceURI(), (input ? "in" : "out") + m.getName()); MessageInfo ms = oi.createMessage(mName, input ? MessageInfo.Type.INPUT : MessageInfo.Type.OUTPUT); if (input) { oi.setInput("in", ms); } else { oi.setOutput("out", ms); } QName mpQName = JAXRSUtils.getClassQName(type); MessagePartInfo mpi = ms.addMessagePart(mpQName); mpi.setConcreteName(mpQName); mpi.setTypeQName(mpQName); mpi.setTypeClass(type); }
private void setTypeAttr(XMLStreamWriter xmlWriter, Message message) throws XMLStreamException { BindingOperationInfo wsdlOperation = getOperation(message); BindingMessageInfo wsdlMessage = isRequestor(message) ? wsdlOperation.getInput() : wsdlOperation.getOutput(); String typeNamespace = wsdlMessage.getMessageInfo().getName().getNamespaceURI(); if (typeNamespace == null || typeNamespace.length() == 0) { throw new IllegalArgumentException("messageType namespace is null or empty"); } xmlWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE + ":" + "msg", typeNamespace); String typeLocalName = wsdlMessage.getMessageInfo().getName().getLocalPart(); if (typeLocalName == null || typeLocalName.length() == 0) { throw new IllegalArgumentException("messageType local name is null or empty"); } xmlWriter.writeAttribute("type", "msg" + ":" + typeLocalName); }
@Override public boolean appliesTo(BindingMessageInfo bmi) { if (bmi == null) { return false; } if ((bmi.getMessageInfo() != null) && (bmi.getMessageInfo().getName() != null) && wsdl11XPointer.matchesMessage( bmi.getMessageInfo().getName().getNamespaceURI(), bmi.getMessageInfo().getName().getLocalPart())) { return true; } if (checkBindingOperationInOut(bmi)) { return true; } return checkPortTypeOperationInOut(bmi); }
private void addInvokeOperation(boolean oneWay) { String name = oneWay ? INVOKE_ONEWAY_NAME : INVOKE_NAME; ServiceInfo info = client.getEndpoint().getEndpointInfo().getService(); OperationInfo opInfo = info.getInterface() .addOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME); MessageInfo mInfo = opInfo.createMessage(new QName(DISPATCH_NS, name + "Request"), Type.INPUT); opInfo.setInput(name + "Request", mInfo); MessagePartInfo mpi = mInfo.addMessagePart("parameters"); if (context == null) { mpi.setTypeClass(cl); } mpi.setElement(true); if (!oneWay) { mInfo = opInfo.createMessage(new QName(DISPATCH_NS, name + "Response"), Type.OUTPUT); opInfo.setOutput(name + "Response", mInfo); mpi = mInfo.addMessagePart("parameters"); mpi.setElement(true); if (context == null) { mpi.setTypeClass(cl); } } for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) { BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo); bind.addOperation(bo); } }
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(); MessagePartInfo inpart = inputPartsMap.get(outpart.getName()); if (inpart == null) { outParts.add(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()); processReturn(method, null); JAXWSBinding mBinding = outputMessage.getOperation().getExtensor(JAXWSBinding.class); for (MessagePartInfo part : outParts) { if (mBinding != null && mBinding.getJaxwsParas() != null) { for (JAXWSParameter jwp : mBinding.getJaxwsParas()) { if (part.getName().getLocalPart().equals(jwp.getPart())) { param.setName(jwp.getName());
List<Class<?>> partClasses = new ArrayList<>(); QName wrapperName = null; for (MessagePartInfo p : wrappedMessageInfo.getMessageParts()) { if (p.getTypeClass() == wrapperClass) { wrapperName = p.getElementQName(); for (MessagePartInfo p : messageInfo.getMessageParts()) { if (p.getTypeClass() == null) { ensureSize(partClasses, p.getIndex()); partNames.set(p.getIndex(), p.getName().getLocalPart()); elementType = p.getTypeQName().getLocalPart();
public List getParameters(MessageInfo msgInfo, String path) { String resource = locations.get(msgInfo.getOperation()); Map<String, String> paramMap = ResourceUtil.getURIParameters(path, resource); List<Object> params = new ArrayList<Object>(msgInfo.getMessageParts().size()); int i = 0; for (MessagePartInfo p : msgInfo.getMessageParts()) { params.add(i, paramMap.get(p.getName().getLocalPart())); i++; } return params; } }