Java Code Examples for javax.wsdl.Definition#getMessage()

The following examples show how to use javax.wsdl.Definition#getMessage() . These examples are extracted from open source projects. 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
private Extensible getMessageTypeInfo(QName name, DescriptionInfo di) {
    if (null == di) {
        return null;
    }
    Definition def = (Definition)di.getProperty("org.apache.cxf.wsdl11.WSDLServiceBuilder.DEFINITION");
    if (null == def) {
        return null;
    }

    javax.wsdl.Message m = def.getMessage(name);
    if (null != m) {
        List<ExtensibilityElement> extensors =
            CastUtils.cast(m.getExtensibilityElements(), ExtensibilityElement.class);
        if (null != extensors) {
            return new ExtensibleInfo(extensors);
        }
    }
    return null;
}
 
Example 2
Source Project: cxf   File: WSDLRefValidator.java    License: Apache License 2.0 5 votes vote down vote up
private javax.wsdl.Message getMessage(QName msgName) {
    javax.wsdl.Message message = this.definition.getMessage(msgName);
    if (message == null) {
        for (Definition d : importedDefinitions) {
            message = d.getMessage(msgName);
            if (message != null) {
                break;
            }
        }
    }
    return message;
}
 
Example 3
Source Project: cxf   File: OperationVisitor.java    License: Apache License 2.0 5 votes vote down vote up
private void createFaultMessage(CorbaTypeImpl corbaType,
                                Operation operation,
                                BindingOperation bindingOperation,
                                QName elementQName) {
    String exceptionName = corbaType.getQName().getLocalPart();

    Definition faultDef = manager.getWSDLDefinition(elementQName.getNamespaceURI());
    if (faultDef == null) {
        faultDef = definition;
    }
    Message faultMsg = faultDef.getMessage(new QName(faultDef.getTargetNamespace(), exceptionName));
    if (faultMsg == null) {
        throw new RuntimeException("Fault message for exception " + exceptionName + " not found");
    }

    // porttype - operation - fault
    Fault fault = definition.createFault();
    fault.setMessage(faultMsg);
    fault.setName(faultMsg.getQName().getLocalPart());
    operation.addFault(fault);

    // binding - operation - corba:operation - corba:raises
    RaisesType raisesType = new RaisesType();
    raisesType.setException(new QName(typeMap.getTargetNamespace(),
                                      exceptionName));
    corbaOperation.getRaises().add(raisesType);

    // binding - operation - fault
    BindingFault bindingFault = definition.createBindingFault();
    bindingFault.setName(faultMsg.getQName().getLocalPart());
    bindingOperation.addBindingFault(bindingFault);

    //add the fault element namespace to the definition
    String nsURI = elementQName.getNamespaceURI();
    manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);
}
 
Example 4
Source Project: cxf   File: SoapBindingFactory.java    License: Apache License 2.0 5 votes vote down vote up
private javax.wsdl.Message findMessage(QName qn, Definition def) {
    javax.wsdl.Message msg = def.getMessage(qn);
    if (msg == null) {
        msg = findMessage(qn, def, new ArrayList<>());
    }
    return msg;
}
 
Example 5
Source Project: cxf   File: ServiceWSDLBuilder.java    License: Apache License 2.0 4 votes vote down vote up
protected void buildService(ServiceInfo serviceInfo, Definition definition) {

        Map<QName, MessageInfo> messages = serviceInfo.getMessages();
        for (Map.Entry<QName, MessageInfo> mie : messages.entrySet()) {
            if (!mie.getKey().getNamespaceURI().equals(definition.getTargetNamespace())) {
                continue;
            }
            if (definition.getMessage(mie.getKey()) != null) {
                continue;
            }
            Message message = definition.createMessage();
            addDocumentation(message, mie.getValue().getMessageDocumentation());
            message.setUndefined(false);
            message.setQName(mie.getKey());
            for (MessagePartInfo mpi : mie.getValue().getMessageParts()) {
                Part part = definition.createPart();
                boolean elemental = mpi.isElement();
                // RFSB will turn on isElement bogusly.
                if (elemental
                    && null == serviceInfo.getXmlSchemaCollection().
                        getElementByQName(mpi.getElementQName())) {
                    elemental = false;
                }
                if (elemental) {
                    part.setElementName(mpi.getElementQName());
                } else {
                    part.setTypeName(mpi.getTypeQName());
                }
                part.setName(mpi.getName().getLocalPart());
                message.addPart(part);
            }

            definition.addMessage(message);
        }

        addDocumentation(definition, serviceInfo.getTopLevelDoc());
        Service serv = definition.createService();
        addDocumentation(serv, serviceInfo.getDocumentation());
        serv.setQName(serviceInfo.getName());
        addNamespace(serviceInfo.getName().getNamespaceURI(), definition);
        addExtensibilityElements(definition, serv, getWSDL11Extensors(serviceInfo));
        definition.addService(serv);

        for (EndpointInfo ei : serviceInfo.getEndpoints()) {
            addNamespace(ei.getTransportId(), definition);
            Port port = definition.createPort();
            addDocumentation(port, ei.getDocumentation());
            port.setName(ei.getName().getLocalPart());
            port.setBinding(definition.getBinding(ei.getBinding().getName()));
            addExtensibilityElements(definition, port, getWSDL11Extensors(ei));
            serv.addPort(port);
        }
    }