Package xsul5.wsdl

Examples of xsul5.wsdl.WsdlDefinitions


    this.graph = WSGraphFactory.createGraph(graphElement);

    XmlElement wsdlsElement = workflowElement.element(WSDLS_TAG);
    for (XmlElement wsdlElement : wsdlsElement.elements(null, WSDL_TAG)) {
      String wsdlText = wsdlElement.requiredText();
      WsdlDefinitions wsdl = WSDLUtil.stringToWSDL(wsdlText);
      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.caught(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(XBayaConstants.LEAD_NS);

    WsdlDefinitions abstractWorkflowWsdl = script.getWorkflowWSDL()
        .getWsdlDefinitions();
    this.odeWorkflowWSDL = abstractWorkflowWsdl;
    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);
    }

    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);

    if (streaming) {
      StreamTransformer streamTransformer = new StreamTransformer();
View Full Code Here

  public static void main(String[] args) throws XBayaException,
      URISyntaxException, GSSException, IOException {
    String workflowAsString = getWorkflow();

    Workflow workflow = new Workflow(workflowAsString);
    WsdlDefinitions wsdl = workflow.getTridentWorkflowWSDL(
        XBayaConstants.DEFAULT_DSC_URL,
        XBayaConstants.DEFAULT_ODE_URL.toString());
    System.out.println("llllllllllllllllllllllllll");
    System.out.println(wsdl.xmlStringPretty());

    ODEClient client = new ODEClient();
    Pair<String, String>[] in = new Pair[3];

    List<WSComponentPort> inputs = client.getInputs(workflow);
View Full Code Here

        try {
            for (WSNode node : GraphUtil.getWSNodes(this.workflow.getGraph())) {
                WSComponent component = node.getComponent();
                QName portTypeQName = component.getPortTypeQName();
                WsdlDefinitions wsdl = component.getWSDL();

                File file = File.createTempFile(".xbaya-"
                        + portTypeQName.getLocalPart(),
                        XBayaConstants.WSDL_SUFFIX);
                this.tmpWSDLFiles.add(file);
                XMLUtil.saveXML(wsdl.xml(), file);

                String wsdlID = JythonScript.getWSDLID(node);
                String wsdlURL = file.toURL().toString();
                arguments.add("-" + wsdlID);
                arguments.add(wsdlURL);
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

   */
  private void addImports(GpelProcess process, WsdlDefinitions workflowWSDL, Map<String, WsdlDefinitions> wsdls) {
    Iterator<String> iterator = wsdls.keySet().iterator();
    while(iterator.hasNext()){
      String id = iterator.next();
      WsdlDefinitions wsdl = wsdls.get(id);
      XmlElement importElement = process.xml().newElement(process.xml().getNamespace(), "import");
      importElement.setAttributeValue("importType", "http://schemas.xmlsoap.org/wsdl/");
      importElement.setAttributeValue("location", wsdl.xml().attributeValue("name")+".wsdl");
      importElement.setAttributeValue("namespace", wsdl.getTargetNamespace());
      process.xml().addChild(0, importElement);
     
    }
   
    XmlElement importElement = process.xml().newElement(process.xml().getNamespace(), "import");
View Full Code Here

        if(isInvoke(next)){
          Iterator<String> keys = wsdls.keySet().iterator();
         
          while(keys.hasNext()){
            String key = keys.next();
            WsdlDefinitions wsdl = wsdls.get(key);
            WsdlPortType portType = wsdl.getPortType(portTypeName);
            if( null != portType){
              WsdlPortTypeOperation wsdlOperation = portType.getOperation(operation);
              WsdlMessagePart part  = wsdl.getMessage(wsdlOperation.getInput().getMessage().getLocalPart()).parts().iterator().next();
              XmlElement childElement = container.addElement(part.getElement().getLocalPart());
              Iterator<GpelAssignCopy> copyItr = assign.copyOperations().iterator();
              while(copyItr.hasNext()){
                GpelAssignCopy copyItm = copyItr.next();
                childElement.addElement(getElementName(copyItm.getTo().getQuery()));
View Full Code Here

        // Create BPEL
        BPELScript bpel = new BPELScript(workflow);
        bpel.create(BPELScriptType.GPEL);
        GpelProcess gpelProcess = bpel.getGpelProcess();
        WorkflowWSDL workflowWSDL = bpel.getWorkflowWSDL();
        WsdlDefinitions definitions = workflowWSDL.getWsdlDefinitions();

        File bpelFile = new File(this.temporalDirectory, filename
                + XBayaConstants.BPEL_SUFFIX);
        File wsdlFile = new File(this.temporalDirectory, filename
                + XBayaConstants.WSDL_SUFFIX);
        XMLUtil.saveXML(gpelProcess.xml(), bpelFile);
        XMLUtil.saveXML(definitions.xml(), wsdlFile);

        // Save the workflow
        File workflowFile = new File(this.temporalDirectory, filename
                + XBayaConstants.WORKFLOW_FILE_SUFFIX);
        XMLUtil.saveXML(workflow.toXML(), workflowFile);

        // Read the workflow
        XmlElement workflowElement = XMLUtil.loadXML(workflowFile);
        workflow = new Workflow(workflowElement);

        // Create BPEL again
        bpel = new BPELScript(workflow);
        bpel.create(BPELScriptType.GPEL);
        gpelProcess = bpel.getGpelProcess();
        workflowWSDL = bpel.getWorkflowWSDL();
        definitions = workflowWSDL.getWsdlDefinitions();

        File bpelFile2 = new File(this.temporalDirectory, filename + "-2"
                + XBayaConstants.BPEL_SUFFIX);
        File wsdlFile2 = new File(this.temporalDirectory, filename + "-2"
                + XBayaConstants.WSDL_SUFFIX);
        XMLUtil.saveXML(gpelProcess.xml(), bpelFile2);
        XMLUtil.saveXML(definitions.xml(), wsdlFile2);

        File workflowFile2 = new File(this.temporalDirectory, filename + "-2"
                + XBayaConstants.WORKFLOW_FILE_SUFFIX);
        XMLUtil.saveXML(workflow.toXML(), workflowFile2);
View Full Code Here

    /**
     * @throws WsdlException
     */
    public void testConvertToCWSDL() throws WsdlException {
        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(
                new File(".").toURI(), new File(SAMPLE_AWSDL).toURI());
        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
        logger.info(definitions.xmlStringPretty());
    }
View Full Code Here

    /**
     *
     */
    public void testMultiplePortTypes() {
        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(
                new File(".").toURI(),
                new File(WSDL_WITH_MULTIPLE_PORT_TYPES).toURI());
        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
        logger.info(definitions.xmlStringPretty());
    }
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.