Package xsul5.wsdl

Examples of xsul5.wsdl.WsdlDefinitions


        workflowElement.addElement(this.graph.toXML());

        // WSDLs
        XmlElement wsdlsElement = workflowElement.addElement(NS_XWF, WSDLS_TAG);
        for (String id : wsdls.keySet()) {
            WsdlDefinitions wsdl = wsdls.get(id);
            XmlElement wsdlElement = wsdlsElement.addElement(NS_XWF, WSDL_TAG);
            wsdlElement.setAttributeValue(NS_XWF, ID_ATTRIBUTE, id);
            wsdlElement.setText(XMLUtil.xmlElementToString(wsdl.xml()));
        }

        // Image
        if (this.image != null) {
            try {
View Full Code Here


        // This map is to avoid creating multiple instances for the a component
        Map<WSComponentKey, WSComponent> components = new HashMap<WSComponentKey, WSComponent>();
        for (WSNode node : GraphUtil.getWSNodes(this.graph)) {
            String id = node.getWSDLID();
            logger.info("id: " + id);
            WsdlDefinitions wsdl = this.wsdlMap.get(id);

            if (wsdl == null) {
                // XXX This happens while loading a workflow that is created by
                // the version 2.2.6_2 or below from GPEL.
                // Need to look for wsdl manually.
View Full Code Here

     */
    private void parse(XmlElement workflowElement) throws GraphException, ComponentException {
        // Graph
        XmlElement graphElement = workflowElement.element(GraphSchema.GRAPH_TAG);
        this.graph = WSGraphFactory.createGraph(graphElement);
        WsdlDefinitions wsdl = null;
        XmlElement wsdlsElement = workflowElement.element(WSDLS_TAG);
        for (XmlElement wsdlElement : wsdlsElement.elements(null, WSDL_TAG)) {
            String wsdlText = wsdlElement.requiredText();
            try {
                wsdl = WSDLUtil.stringToWSDL(wsdlText);
            } catch (UtilsException e) {
                logger.error(e.getMessage(), e);
            }
            String id = wsdlElement.attributeValue(NS_XWF, ID_ATTRIBUTE);
            if (id == null || id.length() == 0) {
                // xwf up to 2.2.6_2 doesn't have ID.
                id = WSDLUtil.getWSDLQName(wsdl).toString();
            }
            addWSDL(id, wsdl);
        }

        bindComponents();

        // Image
        XmlElement imageElement = workflowElement.element(IMAGE_TAG);
        if (imageElement != null) {
            String base64 = imageElement.requiredText();
            byte[] bytes = Base64.decodeBase64(base64.getBytes());
            try {
                this.image = ImageIO.read(new ByteArrayInputStream(bytes));
            } catch (IOException e) {
                // This should not happen and it's OK that image is broken. We
                // can reproduce it anytime.
                logger.error(e.getMessage(), e);
            }
        }

        XmlElement bpelElement = workflowElement.element(BPEL_TAG);
        if (bpelElement != null) {
            try {
                String bpelString = bpelElement.requiredText();
                XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS);
                GpelConstants.GPEL_NS = gpelNS;
                this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString));
            } catch (RuntimeException e) {
                String error = "Failed to parse the BPEL document.";
                throw new GraphException(error, e);
            }
        }

        XmlElement workflowWSDLElement = workflowElement.element(WORKFLOW_WSDL_TAG);
        if (workflowWSDLElement != null) {
            try {
                String wsdlText = workflowWSDLElement.requiredText();
                this.workflowWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlText));
            } catch (RuntimeException e) {
                String error = "Failed to parse the workflow WSDL.";
                throw new GraphException(error, e);
            }
        }
View Full Code Here

        ODEWSDLTransformer wsdlTransformer = new ODEWSDLTransformer();
        script.create(BPELScriptType.BPEL2);
        this.odeProcess = script.getGpelProcess();
        this.odeProcess.setTargetNamespace(WorkflowConstants.LEAD_NS);

        WsdlDefinitions abstractWorkflowWsdl = script.getWorkflowWSDL().getWsdlDefinitions();
        this.odeWorkflowWSDL = abstractWorkflowWsdl;
        try {
            this.odeInvokableWSDL = WSDLUtil.stringToWSDL(abstractWorkflowWsdl.xmlString());
            wsdlTransformer.makeWorkflowWSDLConcrete(this.odeInvokableWSDL, this.getName(), dscUrl);
            wsdlTransformer.setOdeLocation(odeEprEndingWithPort, this.getName(), this.odeInvokableWSDL);

            this.odeWsdlMap = new HashMap<String, WsdlDefinitions>();
            Collection<XmlElement> itr = script.getWSDLs();
            for (XmlElement xmlElement : itr) {
                WsdlDefinitions wsdl = WSDLUtil.stringToWSDL(XmlConstants.BUILDER.serializeToString(xmlElement));
                String id = xmlElement.attributeValue(NS_XWF, ID_ATTRIBUTE);
                if (id == null || id.length() == 0) {
                    // xwf up to 2.2.6_2 doesn't have ID.
                    id = WSDLUtil.getWSDLQName(wsdl).toString();
                    if (null == id || "".equals(id) || (id.startsWith("{") && id.endsWith("}"))) {
                        QName wsdlQname = new QName(NS_XWF.getName(), WSDLUtil.getFirstOperationName(wsdl,
                                WSDLUtil.getFirstPortTypeQName(wsdl)));
                        id = wsdlQname.toString();
                        wsdl.xml().setAttributeValue("name", wsdlQname.getLocalPart());
                    }
                }
                WSDLCleaner.cleanWSDL(wsdl);
                this.odeWsdlMap.put(id, wsdl);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        new ODEBPELTransformer()
                .generateODEBPEL(this.odeProcess, this.getName(), this.odeWorkflowWSDL, this.odeWsdlMap);

        wsdlTransformer.trasnformToODEWsdls(this.getName(), dscUrl, this.odeWorkflowWSDL, this.odeWsdlMap);

        String wsdlString = XMLUtil.xmlElementToString(this.odeWorkflowWSDL.xml());
        this.tridentWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlString));
        new TridentTransformer().process(this.tridentWSDL);

    }
View Full Code Here

        Map<WsdlDefinitions, String> ids = new HashMap<WsdlDefinitions, String>();
        // Use LinkedHashMap to preserve the order of WSDLs, which is useful for
        // some unit tests.

        for (WSNode node : GraphUtil.getNodes(this.graph, WSNode.class)) {
            WsdlDefinitions wsdl = node.getComponent().getWSDL();
            if (wsdls.containsValue(wsdl)) {
                String id = ids.get(wsdl);
                node.setWSDLID(id);
            } else {
                // Assign unique key
View Full Code Here

        workflowElement.addElement(this.graph.toXML());

        // WSDLs
        XmlElement wsdlsElement = workflowElement.addElement(NS_XWF, WSDLS_TAG);
        for (String id : wsdls.keySet()) {
            WsdlDefinitions wsdl = wsdls.get(id);
            XmlElement wsdlElement = wsdlsElement.addElement(NS_XWF, WSDL_TAG);
            wsdlElement.setAttributeValue(NS_XWF, ID_ATTRIBUTE, id);
            wsdlElement.setText(XMLUtil.xmlElementToString(wsdl.xml()));
        }

        // Image
        if (this.image != null) {
            try {
View Full Code Here

        // This map is to avoid creating multiple instances for the a component
        Map<WSComponentKey, WSComponent> components = new HashMap<WSComponentKey, WSComponent>();
        for (WSNode node : GraphUtil.getWSNodes(this.graph)) {
            String id = node.getWSDLID();
            logger.debug("id: " + id);
            WsdlDefinitions wsdl = this.wsdlMap.get(id);

            if (wsdl == null) {
                // XXX This happens while loading a workflow that is created by
                // the version 2.2.6_2 or below from GPEL.
                // Need to look for wsdl manually.
View Full Code Here

     */
    private void parse(XmlElement workflowElement) throws GraphException, ComponentException {
        // Graph
        XmlElement graphElement = workflowElement.element(GraphSchema.GRAPH_TAG);
        this.graph = WSGraphFactory.createGraph(graphElement);
        WsdlDefinitions wsdl = null;
        XmlElement wsdlsElement = workflowElement.element(WSDLS_TAG);
        for (XmlElement wsdlElement : wsdlsElement.elements(null, WSDL_TAG)) {
            String wsdlText = wsdlElement.requiredText();
            try {
                wsdl = WSDLUtil.stringToWSDL(wsdlText);
            } catch (UtilsException e) {
                logger.error(e.getMessage(), e);
            }
            String id = wsdlElement.attributeValue(NS_XWF, ID_ATTRIBUTE);
            if (id == null || id.length() == 0) {
                // xwf up to 2.2.6_2 doesn't have ID.
                id = WSDLUtil.getWSDLQName(wsdl).toString();
            }
            addWSDL(id, wsdl);
        }

        bindComponents();

        // Image
        XmlElement imageElement = workflowElement.element(IMAGE_TAG);
        if (imageElement != null) {
            String base64 = imageElement.requiredText();
            byte[] bytes = Base64.decodeBase64(base64.getBytes());
            try {
                this.image = ImageIO.read(new ByteArrayInputStream(bytes));
            } catch (IOException e) {
                // This should not happen and it's OK that image is broken. We
                // can reproduce it anytime.
                logger.error(e.getMessage(), e);
            }
        }

        XmlElement bpelElement = workflowElement.element(BPEL_TAG);
        if (bpelElement != null) {
            try {
                String bpelString = bpelElement.requiredText();
                XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS);
                GpelConstants.GPEL_NS = gpelNS;
                this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString));
            } catch (RuntimeException e) {
                String error = "Failed to parse the BPEL document.";
                throw new GraphException(error, e);
            }
        }

        XmlElement workflowWSDLElement = workflowElement.element(WORKFLOW_WSDL_TAG);
        if (workflowWSDLElement != null) {
            try {
                String wsdlText = workflowWSDLElement.requiredText();
                this.workflowWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlText));
            } catch (RuntimeException e) {
                String error = "Failed to parse the workflow WSDL.";
                throw new GraphException(error, e);
            }
        }
View Full Code Here

        ODEWSDLTransformer wsdlTransformer = new ODEWSDLTransformer();
        script.create(BPELScriptType.BPEL2);
        this.odeProcess = script.getGpelProcess();
        this.odeProcess.setTargetNamespace(WorkflowConstants.LEAD_NS);

        WsdlDefinitions abstractWorkflowWsdl = script.getWorkflowWSDL().getWsdlDefinitions();
        this.odeWorkflowWSDL = abstractWorkflowWsdl;
        try {
            this.odeInvokableWSDL = WSDLUtil.stringToWSDL(abstractWorkflowWsdl.xmlString());
            wsdlTransformer.makeWorkflowWSDLConcrete(this.odeInvokableWSDL, this.getName(), dscUrl);
            wsdlTransformer.setOdeLocation(odeEprEndingWithPort, this.getName(), this.odeInvokableWSDL);

            this.odeWsdlMap = new HashMap<String, WsdlDefinitions>();
            Collection<XmlElement> itr = script.getWSDLs();
            for (XmlElement xmlElement : itr) {
                WsdlDefinitions wsdl = WSDLUtil.stringToWSDL(XmlConstants.BUILDER.serializeToString(xmlElement));
                String id = xmlElement.attributeValue(NS_XWF, ID_ATTRIBUTE);
                if (id == null || id.length() == 0) {
                    // xwf up to 2.2.6_2 doesn't have ID.
                    id = WSDLUtil.getWSDLQName(wsdl).toString();
                    if (null == id || "".equals(id) || (id.startsWith("{") && id.endsWith("}"))) {
                        QName wsdlQname = new QName(NS_XWF.getName(), WSDLUtil.getFirstOperationName(wsdl,
                                WSDLUtil.getFirstPortTypeQName(wsdl)));
                        id = wsdlQname.toString();
                        wsdl.xml().setAttributeValue("name", wsdlQname.getLocalPart());
                    }
                }
                WSDLCleaner.cleanWSDL(wsdl);
                this.odeWsdlMap.put(id, wsdl);
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        new ODEBPELTransformer()
                .generateODEBPEL(this.odeProcess, this.getName(), this.odeWorkflowWSDL, this.odeWsdlMap);

        wsdlTransformer.trasnformToODEWsdls(this.getName(), dscUrl, this.odeWorkflowWSDL, this.odeWsdlMap);

        String wsdlString = XMLUtil.xmlElementToString(this.odeWorkflowWSDL.xml());
        this.tridentWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlString));
        new TridentTransformer().process(this.tridentWSDL);

    }
View Full Code Here

    /**
     * @throws WsdlException
     */
    public void test() throws WsdlException {
        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
                new File(SAMPLE_AWSDL).toURI());
        URI dscURL = this.configuration.getDSCURL();
        logger.info("dscURL: " + dscURL);
        DSCUtil.convertToCWSDL(definitions, dscURL);

        logger.info(definitions.xmlStringPretty());

        // client
        int clientPort = 0;
        WSIFAsyncResponsesCorrelator correlator = new XsulSoapHttpWsaResponsesCorrelator(clientPort);
        String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
        logger.info("client is waiting at " + serverLoc);

        // LEAD Context Header
        // Create lead context.
        LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
        leadContextHelper.setXBayaConfiguration(this.configuration);
        LeadContextHeader leadContext = leadContextHelper.getLeadContextHeader();
        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
        leadContext.setNodeId("decoder1");
        leadContext.setTimeStep("5");
        leadContext.setServiceInstanceId(URI.create("decoder-instance-10"));

        XmlElement element3 = XMLUtil.xmlElement5ToXmlElement3(definitions.xml());
        xsul.wsdl.WsdlDefinitions definitions3 = new xsul.wsdl.WsdlDefinitions(element3);

        WSIFClient wclient = WSIFRuntime.getDefault().newClientFor(definitions3, "TestCMD_Example1SoapPort");
        StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-lead-header", leadContext);

View Full Code Here

TOP

Related Classes of xsul5.wsdl.WsdlDefinitions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.