for (ServiceInfo si : getService().getServiceInfos()) { for (EndpointInfo ep : si.getEndpoints()) { enames.add(ep.getName()); QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke"); if (!isFromWsdl()) { for (EndpointInfo ei : si.getEndpoints()) { ei.setProperty("soap.no.validate.parts", Boolean.TRUE); for (BindingOperationInfo bop : bind.getOperations()) { OperationInfo o = bop.getOperationInfo(); if (bop.isUnwrappedCapable()) { bop.getOperationInfo().setUnwrappedOperation(null); bop.setUnwrappedOperation(null); bop.getInput().setMessageParts(messageParts); inf.setConcreteName(new QName(o.getName().getNamespaceURI(), bop.getOutput().setMessageParts(messageParts); mpi.setTypeQName(Constants.XSD_ANYTYPE); BindingOperationInfo bo = new BindingOperationInfo(bind, op); op.setProperty("operation.is.synthetic", Boolean.TRUE); bo.setProperty("operation.is.synthetic", Boolean.TRUE);
ret = exchange.get(mappedkey); if (ret != null) { return ret; ret = tmp.get(Message.PROTOCOL_HEADERS); if (boi != null && !Boolean.TRUE.equals(boi.getProperty("operation.is.synthetic"))) { ret = boi.getName(); ret = boi.getBinding().getService().getName(); ret = boi.getBinding().getService().getInterface().getName(); ret = endpointInfo.getName(); URI wsdlDescription = endpointInfo.getProperty("URI", URI.class); if (wsdlDescription == null) { String address = endpointInfo.getAddress(); try { wsdlDescription = new URI(address + "?wsdl");
public void handleMessage(SoapMessage message) throws Fault { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop == null) { return; if (bop.isUnwrapped()) { bop = bop.getWrappedOperation(); BindingMessageInfo bmi = client ? bop.getOutput() : bop.getInput(); String partName = mpi.getConcreteName().getLocalPart();
for (BindingOperationInfo bop : bindingInfo.getOperations()) { 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);
final Object serviceObject, Method m, List<Object> params) { JaxwsServerHandler h = exchange.get(JaxwsServerHandler.class); if (h != null && h.isDone()) { BindingOperationInfo bop = exchange.getBindingOperationInfo(); if (bop.isUnwrapped()) { exchange.put(BindingOperationInfo.class, bop.getWrappedOperation()); exchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); throw createFault(ex.getCause(), m, params, true); h.waitForDone(); BindingOperationInfo bop = exchange.getBindingOperationInfo(); if (bop.isUnwrapped()) { exchange.put(BindingOperationInfo.class, bop.getWrappedOperation()); exchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT); throw createFault(ex.getCause(), m, params, true);
public void handleMessage(SoapMessage message) throws Fault { Exchange ex = message.getExchange(); BindingOperationInfo bop = ex.getBindingOperationInfo(); if (bop == null) { return; } if (bop.isUnwrapped()) { bop = bop.getWrappedOperation(); } boolean client = isRequestor(message); BindingMessageInfo bmi = client ? bop.getInput() : bop.getOutput(); if (bmi == null) { return; } SoapBodyInfo sbi = bmi.getExtensor(SoapBodyInfo.class); if (sbi == null || sbi.getAttachments() == null || sbi.getAttachments().isEmpty()) { Service s = ex.getService(); DataBinding db = s.getDataBinding(); if (db instanceof JAXBDataBinding && hasSwaRef((JAXBDataBinding) db)) { setupAttachmentOutput(message); } return; } processAttachments(message, sbi); } protected void processAttachments(SoapMessage message, SoapBodyInfo sbi) {
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 boolean checkBindingOperationFault(BindingFaultInfo bfi) { return (bfi.getFaultInfo() != null) && (bfi.getFaultInfo().getFaultName() != null) && (bfi.getBindingOperation().getName() != null) && (bfi.getBindingOperation().getBinding() != null) && (bfi.getBindingOperation().getBinding().getName() != null) && wsdl11XPointer.matchesBindingOperationFault( bfi.getFaultInfo().getFaultName().getNamespaceURI(), bfi.getBindingOperation().getBinding().getName().getLocalPart(), bfi.getBindingOperation().getName().getLocalPart(), bfi.getFaultInfo().getFaultName().getLocalPart()); }
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(); 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 BindingOperationInfo getInvocationOperation() throws Exception { // Normally its not this hard to invoke the CXF Client, but we're // sending along some exchange properties, so we need to use a more advanced // method Endpoint ep = client.getEndpoint(); // The operation is always named invoke because hits our ProxyService implementation. QName q = new QName(ep.getService().getName().getNamespaceURI(), "invoke"); BindingOperationInfo bop = ep.getBinding().getBindingInfo().getOperation(q); if (bop.isUnwrappedCapable()) { bop = bop.getUnwrappedOperation(); } return bop; }
private BindingOperationInfo getOperation(Message message, QName opName) { BindingOperationInfo bop = ServiceModelUtil.getOperation(message.getExchange(), opName); if (bop == null) { Endpoint ep = message.getExchange().getEndpoint(); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); boolean output = !isRequestor(message); for (BindingOperationInfo info : service.getOperations()) { if (info.getName().getLocalPart().equals(opName.getLocalPart())) { SoapBody body = null; if (output) { body = info.getOutput().getExtensor(SoapBody.class); } else { body = info.getInput().getExtensor(SoapBody.class); } if (body != null && opName.getNamespaceURI().equals(body.getNamespaceURI())) { return info; } } } } return bop; } public void handleMessage(Message message) {
@Override public boolean appliesTo(BindingOperationInfo boi) { if (boi == null) { return false; } if ((boi.getBinding() != null) && (boi.getBinding().getName() != null) && wsdl11XPointer.matchesBinding( boi.getBinding().getName().getNamespaceURI(), boi.getBinding().getName().getLocalPart())) { return true; } if ((boi.getName() != null) && (boi.getBinding() != null) && (boi.getBinding().getName() != null) && wsdl11XPointer.matchesBindingOperation( boi.getBinding().getName().getNamespaceURI(), boi.getBinding().getName().getLocalPart(), boi.getName().getLocalPart())) { return true; } return (boi.getOperationInfo() != null) && (boi.getOperationInfo().getInterface() != null) && (boi.getOperationInfo().getInterface().getName() != null) && (boi.getOperationInfo().getName() != null) && wsdl11XPointer.matchesPortTypeOperation( boi.getOperationInfo().getInterface().getName().getNamespaceURI(), boi.getOperationInfo().getInterface().getName().getLocalPart(), boi.getOperationInfo().getName().getLocalPart()); }
protected void buildBindingOperation(Definition def, Binding binding, Collection<BindingOperationInfo> bindingOperationInfos) { BindingOperation bindingOperation = null; for (BindingOperationInfo bindingOperationInfo : bindingOperationInfos) { bindingOperation = def.createBindingOperation(); addDocumentation(bindingOperation, bindingOperationInfo.getDocumentation()); bindingOperation.setName(bindingOperationInfo.getName().getLocalPart()); for (Operation operation : CastUtils.cast(binding.getPortType().getOperations(), Operation.class)) { if (operation.getName().equals(bindingOperation.getName())) { bindingOperation.setOperation(operation); break; } } buildBindingInput(def, bindingOperation, bindingOperationInfo.getInput()); buildBindingOutput(def, bindingOperation, bindingOperationInfo.getOutput()); buildBindingFault(def, bindingOperation, bindingOperationInfo.getFaults()); addExtensibilityAttributes(def, bindingOperation, bindingOperationInfo.getExtensionAttributes()); addExtensibilityElements(def, bindingOperation, getWSDL11Extensors(bindingOperationInfo)); binding.addBindingOperation(bindingOperation); } }
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); } } }
public static BindingOperationInfo getOperation(Exchange exchange, String opName) { Endpoint ep = exchange.get(Endpoint.class); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); for (BindingOperationInfo b : service.getOperations()) { if (b.getName().getLocalPart().equals(opName)) { return b; } } return null; }
public static BindingOperationInfo getOperation(Exchange exchange, String opName) { Endpoint ep = exchange.getEndpoint(); if (ep == null) { return null; } BindingInfo service = ep.getEndpointInfo().getBinding(); for (BindingOperationInfo b : service.getOperations()) { if (b.getName().getLocalPart().equals(opName)) { return b; } } return null; }
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) {
/** {@inheritDoc}*/ @Override public MetricsContext createOperationContext(Endpoint endpoint, BindingOperationInfo boi, boolean asClient, String clientId) { StringBuilder buffer = getBaseServiceName(endpoint, asClient, clientId); buffer.append("Operation=").append(boi.getName().getLocalPart()).append(','); return new CodahaleMetricsContext(buffer.toString(), registry); }
Method method = ex.get(Method.class); if (boi.isUnwrappedCapable()) { BindingOperationInfo boi2 = boi.getUnwrappedOperation(); OperationInfo op = boi2.getOperationInfo(); BindingMessageInfo bmi; MessageInfo wrappedMessageInfo = message.get(MessageInfo.class); MessageInfo messageInfo; if (wrappedMessageInfo == boi.getOperationInfo().getInput()) { messageInfo = op.getInput(); bmi = boi2.getInput(); } else { messageInfo = op.getOutput(); bmi = boi2.getOutput(); message.put(MessageInfo.class, messageInfo); message.put(BindingMessageInfo.class, bmi); ex.put(BindingOperationInfo.class, boi2); MessagePartInfo mpi = null; for (MessagePartInfo mpi2 : wrappedMessageInfo.getMessageParts()) { if (mpi2.getConcreteName().equals(part.getConcreteName())) { mpi = mpi2;
private BindingOperationInfo getBindingOperationInfo(DepthXMLStreamReader xmlReader, Exchange exchange, BindingOperationInfo bop, boolean client) { //bop might be a unwrapped, wrap it back so that we can get correct info if (bop != null && bop.isUnwrapped()) { bop = bop.getWrappedOperation(); } if (bop == null) { QName startQName = xmlReader == null ? new QName("http://cxf.apache.org/jaxws/provider", "invoke") : xmlReader.getName(); bop = getBindingOperationInfo(exchange, startQName, client); } return bop; }