Search in sources :

Example 91 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class WSDLToServiceProcessor method doAppendService.

private void doAppendService() throws ToolException {
    if (service == null) {
        service = wsdlDefinition.createService();
        service.setQName(new QName(WSDLConstants.WSDL_PREFIX, (String) env.get(ToolConstants.CFG_SERVICE)));
    }
    if (port == null) {
        port = wsdlDefinition.createPort();
        port.setName((String) env.get(ToolConstants.CFG_PORT));
        port.setBinding(binding);
    }
    setAddrElement();
    service.addPort(port);
    wsdlDefinition.addService(service);
    WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
    Writer outputWriter = getOutputWriter(NEW_FILE_NAME_MODIFIER);
    try {
        wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
        throw new ToolException(msg, wse);
    }
    try {
        outputWriter.close();
    } catch (IOException ioe) {
        Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
        throw new ToolException(msg, ioe);
    }
}
Also used : Message(org.apache.cxf.common.i18n.Message) WSDLException(javax.wsdl.WSDLException) QName(javax.xml.namespace.QName) WSDLWriter(javax.wsdl.xml.WSDLWriter) ToolException(org.apache.cxf.tools.common.ToolException) IOException(java.io.IOException) Writer(java.io.Writer) WSDLWriter(javax.wsdl.xml.WSDLWriter)

Example 92 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class WSDLToServiceProcessor method process.

public void process() throws ToolException {
    init();
    if (isServicePortExisted()) {
        Message msg = new Message("SERVICE_PORT_EXIST", LOG);
        throw new ToolException(msg);
    }
    if (!isBindingExisted()) {
        Message msg = new Message("BINDING_NOT_EXIST", LOG);
        throw new ToolException(msg);
    }
    doAppendService();
}
Also used : Message(org.apache.cxf.common.i18n.Message) ToolException(org.apache.cxf.tools.common.ToolException)

Example 93 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class WSDLToServiceProcessor method setAddrElement.

private void setAddrElement() throws ToolException {
    String transport = (String) env.get(ToolConstants.CFG_TRANSPORT);
    Address address = AddressFactory.getInstance().getAddresser(transport);
    Map<String, String> ns = address.getNamespaces(env);
    for (Map.Entry<String, String> entry : ns.entrySet()) {
        wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
    }
    WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
    try {
        ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
        port.addExtensibilityElement(extElement);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
        throw new ToolException(msg, wse);
    }
}
Also used : Address(org.apache.cxf.tools.misc.processor.address.Address) Message(org.apache.cxf.common.i18n.Message) WSDLException(javax.wsdl.WSDLException) WSDLExtensibilityPlugin(org.apache.cxf.wsdl.WSDLExtensibilityPlugin) ToolException(org.apache.cxf.tools.common.ToolException) Map(java.util.Map) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 94 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class ProviderImpl method createEndpoint.

@Override
public Endpoint createEndpoint(String bindingId, Object implementor) {
    Endpoint ep = null;
    if (EndpointUtils.isValidImplementor(implementor)) {
        Bus bus = BusFactory.getThreadDefaultBus();
        ep = createEndpointImpl(bus, bindingId, implementor);
        return ep;
    }
    throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
Also used : Bus(org.apache.cxf.Bus) Endpoint(javax.xml.ws.Endpoint) WebServiceException(javax.xml.ws.WebServiceException) Message(org.apache.cxf.common.i18n.Message)

Example 95 with Message

use of org.apache.cxf.common.i18n.Message in project cxf by apache.

the class JMSConfigFeature method initialize.

@Override
public void initialize(Server server, Bus bus) {
    checkJmsConfig();
    Destination destination = server.getDestination();
    if (!(destination instanceof JMSDestination)) {
        throw new ConfigurationException(new Message("JMSCONFIGFEATURE_ONLY_JMS", LOG));
    }
    JMSDestination jmsDestination = (JMSDestination) destination;
    jmsDestination.setJmsConfig(jmsConfig);
    super.initialize(server, bus);
}
Also used : Destination(org.apache.cxf.transport.Destination) Message(org.apache.cxf.common.i18n.Message) ConfigurationException(org.apache.cxf.configuration.ConfigurationException)

Aggregations

Message (org.apache.cxf.common.i18n.Message)201 ToolException (org.apache.cxf.tools.common.ToolException)69 IOException (java.io.IOException)45 QName (javax.xml.namespace.QName)42 Fault (org.apache.cxf.interceptor.Fault)34 XMLStreamException (javax.xml.stream.XMLStreamException)27 JAXBException (javax.xml.bind.JAXBException)23 ArrayList (java.util.ArrayList)19 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)17 Element (org.w3c.dom.Element)17 File (java.io.File)16 WSDLException (javax.wsdl.WSDLException)15 Method (java.lang.reflect.Method)14 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)13 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)12 InputStream (java.io.InputStream)11 HashMap (java.util.HashMap)11 List (java.util.List)11 Map (java.util.Map)11 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)11