Search in sources :

Example 6 with Definition

use of javax.wsdl.Definition in project pentaho-platform by pentaho.

the class AxisUtil method createServiceWsdl.

/**
 * Creates the WSDL for an Axis service
 *
 * @param axisService
 * @param wrapper
 * @throws Exception
 */
public static void createServiceWsdl(AxisService axisService, IServiceConfig wsDef, AxisConfiguration axisConfig) throws Exception {
    // specific that we are generating the WSDL
    Parameter useOriginalwsdl = new Parameter();
    // $NON-NLS-1$
    useOriginalwsdl.setName("useOriginalwsdl");
    // $NON-NLS-1$
    useOriginalwsdl.setValue("true");
    axisService.addParameter(useOriginalwsdl);
    // get the WSDL generation and make it a parameter
    Definition wsdlDefn = AxisUtil.getWsdlDefinition(axisConfig, wsDef);
    Parameter wsdl = new Parameter();
    wsdl.setName(WSDLConstants.WSDL_4_J_DEFINITION);
    wsdl.setValue(wsdlDefn);
    // add the WSDL parameter to the service
    axisService.addParameter(wsdl);
}
Also used : Definition(javax.wsdl.Definition) Parameter(org.apache.axis2.description.Parameter)

Example 7 with Definition

use of javax.wsdl.Definition in project carbon-business-process by wso2.

the class AxisServiceUtils method createAxisServiceBuilder.

private static WSDL11ToAxisServiceBuilder createAxisServiceBuilder(BPELProcessProxy processProxy) throws AxisFault {
    Definition wsdlDef = processProxy.getWsdlDefinition();
    QName serviceName = processProxy.getServiceName();
    String portName = processProxy.getPort();
    ProcessConf pConf = processProxy.getProcessConfiguration();
    QName pid = pConf.getProcessId();
    InputStream wsdlInStream = null;
    URI wsdlBaseURI = pConf.getBaseURI().resolve(wsdlDef.getDocumentBaseURI());
    try {
        wsdlInStream = wsdlBaseURI.toURL().openStream();
    } catch (MalformedURLException e) {
        String errMsg = "Malformed WSDL base URI.";
        handleException(pid, errMsg, e);
    } catch (IOException e) {
        String errMsg = "Error opening stream.";
        handleException(pid, errMsg, e);
    }
    WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisPatchedBuilder(wsdlInStream, serviceName, portName);
    serviceBuilder.setBaseUri(wsdlBaseURI.toString());
    serviceBuilder.setCustomResolver(new Axis2UriResolver());
    try {
        serviceBuilder.setCustomWSDLResolver(new Axis2WSDLLocator(wsdlBaseURI));
    } catch (URISyntaxException e) {
        String errorMessage = "URI syntax invalid.";
        handleException(pid, errorMessage, e);
    }
    serviceBuilder.setServerSide(true);
    return serviceBuilder;
}
Also used : Axis2UriResolver(org.wso2.carbon.bpel.core.ode.integration.axis2.Axis2UriResolver) MalformedURLException(java.net.MalformedURLException) QName(javax.xml.namespace.QName) InputStream(java.io.InputStream) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) Definition(javax.wsdl.Definition) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) WSDL11ToAxisServiceBuilder(org.apache.axis2.description.WSDL11ToAxisServiceBuilder) Axis2WSDLLocator(org.wso2.carbon.bpel.core.ode.integration.axis2.Axis2WSDLLocator)

Example 8 with Definition

use of javax.wsdl.Definition in project carbon-business-process by wso2.

the class AxisServiceUtils method createAxisService.

/**
 * Build the underlying Axis Service from Service QName and Port Name of interest using given WSDL
 * for BPEL document.
 * In the current implementation we are extracting service name from the soap:address' location property.
 * But specified port may not contain soap:adress instead it may contains http:address. We need to handle that
 * situation.
 *
 * @param axisConfiguration AxisConfiguration to which we should publish the service
 * @param processProxy      BPELProcessProxy
 * @return Axis Service build using WSDL, Service and Port
 * @throws org.apache.axis2.AxisFault on error
 */
public static AxisService createAxisService(AxisConfiguration axisConfiguration, BPELProcessProxy processProxy) throws AxisFault {
    QName serviceName = processProxy.getServiceName();
    String portName = processProxy.getPort();
    Definition wsdlDefinition = processProxy.getWsdlDefinition();
    ProcessConf processConfiguration = processProxy.getProcessConfiguration();
    if (log.isDebugEnabled()) {
        log.debug("Creating AxisService: Service=" + serviceName + " port=" + portName + " WSDL=" + wsdlDefinition.getDocumentBaseURI() + " BPEL=" + processConfiguration.getBpelDocument());
    }
    WSDL11ToAxisServiceBuilder serviceBuilder = createAxisServiceBuilder(processProxy);
    /**
     * Need to figure out a way to handle service name extractoin. According to my perspective extracting
     * the service name from the EPR is not a good decision. But we need to handle JMS case properly.
     * I am keeping JMS handling untouched until we figureout best solution.
     */
    /* String axisServiceName = extractServiceName(processConf, wsdlServiceName, portName);*/
    AxisService axisService = populateAxisService(processProxy, axisConfiguration, serviceBuilder);
    Iterator operations = axisService.getOperations();
    BPELMessageReceiver messageRec = new BPELMessageReceiver();
    /**
     * Set the corresponding BPELService to message receivers
     */
    messageRec.setProcessProxy(processProxy);
    while (operations.hasNext()) {
        AxisOperation operation = (AxisOperation) operations.next();
        // Setting WSDLAwareMessage Receiver even if operation has a message receiver specified.
        // This is to fix the issue when build service configuration using services.xml(Always RPCMessageReceiver
        // is set to operations).
        operation.setMessageReceiver(messageRec);
        axisConfiguration.getPhasesInfo().setOperationPhases(operation);
    }
    /**
     * TODO: JMS Destination handling.
     */
    return axisService;
}
Also used : AxisOperation(org.apache.axis2.description.AxisOperation) QName(javax.xml.namespace.QName) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) AxisService(org.apache.axis2.description.AxisService) Definition(javax.wsdl.Definition) Iterator(java.util.Iterator) WSDL11ToAxisServiceBuilder(org.apache.axis2.description.WSDL11ToAxisServiceBuilder) BPELMessageReceiver(org.wso2.carbon.bpel.core.ode.integration.axis2.receivers.BPELMessageReceiver)

Example 9 with Definition

use of javax.wsdl.Definition in project carbon-business-process by wso2.

the class BPELMessageContextFactory method getWSDLDefinitionFromAxisService.

private static Definition getWSDLDefinitionFromAxisService(final AxisService service) {
    Definition wsdlDefinition = (Definition) service.getParameter(BPELConstants.WSDL_4_J_DEFINITION).getValue();
    QName serviceName = new QName(service.getTargetNamespace(), service.getName());
    if (wsdlDefinition == null) {
        throw new NullPointerException("No WSDL Definition was found for service " + serviceName.getLocalPart() + ".");
    }
    checkWhetherServiceDefinitionIsAvailable(wsdlDefinition, serviceName);
    return wsdlDefinition;
}
Also used : QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition)

Example 10 with Definition

use of javax.wsdl.Definition in project carbon-business-process by wso2.

the class BPELBindingContextImpl method createPartnerService.

private PartnerService createPartnerService(ProcessConf pConf, QName serviceName, String portName) throws ContextException {
    PartnerService partnerService;
    Definition def = pConf.getDefinitionForService(serviceName);
    try {
        if (log.isDebugEnabled()) {
            log.debug("Creating external service " + serviceName);
        }
        partnerService = new PartnerService(def, serviceName, portName, getConfigurationContextFromProcessConfiguration(pConf), pConf, bpelServer.getHttpConnectionManager());
    } catch (Exception ex) {
        throw new ContextException("Error creating external service! name:" + serviceName + ", port:" + portName, ex);
    }
    // if not SOAP nor HTTP binding
    if (partnerService == null) {
        throw new ContextException("Only SOAP and HTTP binding supported!");
    }
    if (log.isDebugEnabled()) {
        log.debug("Created external service " + serviceName);
    }
    return partnerService;
}
Also used : Definition(javax.wsdl.Definition) DeploymentException(org.apache.axis2.deployment.DeploymentException) ContextException(org.apache.ode.bpel.iapi.ContextException) ContextException(org.apache.ode.bpel.iapi.ContextException)

Aggregations

Definition (javax.wsdl.Definition)226 Test (org.junit.Test)113 QName (javax.xml.namespace.QName)61 File (java.io.File)52 Document (org.w3c.dom.Document)44 Element (org.w3c.dom.Element)40 HashMap (java.util.HashMap)36 WSDLReader (javax.wsdl.xml.WSDLReader)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)31 JBossWSTest (org.jboss.wsf.test.JBossWSTest)31 Service (javax.wsdl.Service)24 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)23 URL (java.net.URL)21 ArrayList (java.util.ArrayList)21 Port (javax.wsdl.Port)21 WSDLToIDLAction (org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction)21 Bus (org.apache.cxf.Bus)20 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)20 WSDLManager (org.apache.cxf.wsdl.WSDLManager)20 IOException (java.io.IOException)18