Package xsul5.wsdl

Examples of xsul5.wsdl.WsdlDefinitions


    private void transformServiceWsdls(Map<String, WsdlDefinitions> wsdls, URI dscUrl) {
        Set<String> keys = wsdls.keySet();

        for (String string : keys) {
            WsdlDefinitions wsdl = wsdls.get(string);
            // Replacing the gfac xsd remote urls
            // this was done because avoid network inaccisibilities
            WSDLUtil.replaceAttributeValue(wsdl.getTypes(), "schemaLocation",
                    "http://www.extreme.indiana.edu/gfac/gfac-simple-types.xsd", "gfac-simple-types.xsd");
            addBindings(wsdl, dscUrl);
            addImportsAndHeaderMessage(wsdl);
        }
    }
View Full Code Here


     * For debugging
     *
     * @param args
     */
    public static void main(String[] args) {
        WsdlDefinitions awsdl = WsdlResolver.getInstance().loadWsdl(DSCUtil.class, "wsdls/math/adder-awsdl.xml");
        WsdlDefinitions cwsdl = convertToCWSDL(awsdl, URI.create("http://localhost"));
        System.out.println(cwsdl.xmlStringPretty());
    }
View Full Code Here

    public static Map<String, WsdlDefinitions> createCWSDLs(Workflow workflow, URI dscURL) {
        Map<String, WsdlDefinitions> WSDLMap = new HashMap<String, WsdlDefinitions>();
        Graph graph = workflow.getGraph();
        for (WSNode node : GraphUtil.getWSNodes(graph)) {
            String partnerLinkName = BPELScript.createPartnerLinkName(node.getID());
            WsdlDefinitions wsdl = node.getComponent().getWSDL();
            if (WSDLUtil.isAWSDL(wsdl)) {
                try {
                    wsdl = convertToCWSDL(WSDLUtil.deepClone(wsdl), dscURL);
                } catch (UtilsException e) {
                    e.printStackTrace();
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

     * @return The list of components in the specified WSDL.
     * @throws ComponentException
     */
    public static List<WSComponent> createComponents(XmlElement componentElement) throws ComponentException {
        try {
            WsdlDefinitions definitions = new WsdlDefinitions(componentElement);
            return createComponents(definitions);
        } catch (RuntimeException e) {
            throw new ComponentException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
        }
    }
View Full Code Here

    private QName findMessage(GpelProcess gpelProcess, QName portType, String opName, boolean input,
            Map<String, WsdlDefinitions> wsdls) {
        Iterator<String> iterator = wsdls.keySet().iterator();
        while (iterator.hasNext()) {
            String key = (String) iterator.next();
            WsdlDefinitions wsdlDefinitions = wsdls.get(key);
            WsdlPortType pType = wsdlDefinitions.getPortType(portType.getLocalPart());
            WsdlPortTypeOperation operation = null;
            if (null != pType && null != (operation = pType.getOperation(opName))) {

                if (input) {
                    WsdlPortTypeInput messageRef = operation.getInput();
                    if (null != messageRef && null != messageRef.getMessage()) {
                        WsdlMessage message = wsdlDefinitions.getMessage(messageRef.getMessage().getLocalPart());
                        if (null != message) {
                            return new QName(wsdlDefinitions.getTargetNamespace(), message.getName(), key);
                        }
                    }
                } else {
                    xsul5.wsdl.WsdlPortTypeOutput messageRef = operation.getOutput();
                    if (null != messageRef && null != messageRef.getMessage()) {
                        WsdlMessage message = wsdlDefinitions.getMessage(messageRef.getMessage().getLocalPart());
                        if (null != message) {
                            return new QName(wsdlDefinitions.getTargetNamespace(), message.getName(), key);
                        }
                    }
                }

            }
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.