Java Code Examples for org.apache.cxf.service.model.BindingMessageInfo#getExtensors()

The following examples show how to use org.apache.cxf.service.model.BindingMessageInfo#getExtensors() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HeaderUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static Set<QName> getHeaderQNames(BindingMessageInfo bmi) {
    Set<QName> set = new HashSet<>();
    List<MessagePartInfo> mps = bmi.getMessageInfo().getMessageParts();
    List<ExtensibilityElement> extList = bmi.getExtensors(ExtensibilityElement.class);
    if (extList != null) {
        for (ExtensibilityElement ext : extList) {
            if (SOAPBindingUtil.isSOAPHeader(ext)) {
                SoapHeader header = SOAPBindingUtil.getSoapHeader(ext);
                String pn = header.getPart();
                for (MessagePartInfo mpi : mps) {
                    if (pn.equals(mpi.getName().getLocalPart())) {
                        if (mpi.isElement()) {
                            set.add(mpi.getElementQName());
                        } else {
                            set.add(mpi.getTypeQName());
                        }
                        break;
                    }
                }
            }
        }
    }
    return set;
}
 
Example 2
Source File: BindingHelper.java    From syndesis with Apache License 2.0 5 votes vote down vote up
BindingHelper(BindingMessageInfo bindingMessageInfo) throws ParserException, ParserConfigurationException {

        this.bindingMessageInfo = bindingMessageInfo;
        this.bindingOperation = bindingMessageInfo.getBindingOperation();
        this.schemaCollection = bindingMessageInfo.getBindingOperation().getBinding().getService().getXmlSchemaCollection();

        SoapOperationInfo soapOperationInfo = bindingOperation.getExtensor(SoapOperationInfo.class);
        SoapBindingInfo soapBindingInfo = (SoapBindingInfo) bindingOperation.getBinding();

        soapVersion = soapBindingInfo.getSoapVersion();

        // get binding style
        if (soapOperationInfo.getStyle() != null) {
            style = Style.valueOf(soapOperationInfo.getStyle().toUpperCase(Locale.US));
        } else if (soapBindingInfo.getStyle() != null) {
            style = Style.valueOf(soapBindingInfo.getStyle().toUpperCase(Locale.US));
        } else {
            style = Style.DOCUMENT;
        }

        // get body binding
        SoapBodyInfo soapBodyInfo = bindingMessageInfo.getExtensor(SoapBodyInfo.class);
        List<SoapHeaderInfo> soapHeaders = bindingMessageInfo.getExtensors(SoapHeaderInfo.class);
        bodyParts = soapBodyInfo.getParts();

        // get any headers as MessagePartInfos
        hasHeaders = soapHeaders != null && !soapHeaders.isEmpty();
        headerParts = hasHeaders ?
            soapHeaders.stream().map(SoapHeaderInfo::getPart).collect(Collectors.toList()) : null;

        // get required body use
        Use use = Use.valueOf(soapBodyInfo.getUse().toUpperCase(Locale.US));
        if (ENCODED.equals(use)) {
            // TODO could we add support for RPC/encoded messages by setting schema type to any??
            throw new ParserException("Messages with use='encoded' are not supported");
        }

        // Document builder for create schemaset
        this.documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    }
 
Example 3
Source File: WSDLServiceBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void handleHeader(BindingMessageInfo bindingMessageInfo) {
    // mark all message part which should be in header
    List<ExtensibilityElement> extensiblilityElement = bindingMessageInfo
        .getExtensors(ExtensibilityElement.class);
    // for non-soap binding, the extensiblilityElement could be null
    if (extensiblilityElement == null) {
        return;
    }
    // for (ExtensibilityElement element : extensiblilityElement) {
    // LOG.info("the extensibility is " + element.getClass().getName());
    // if (element instanceof SOAPHeader) {
    // LOG.info("the header is " + ((SOAPHeader)element).getPart());
    // }
    // }
}