Package org.xmlpull.infoset

Examples of org.xmlpull.infoset.XmlNamespace


        //adding new operation for the receive
        Iterator<WsdlPortType> portTypes = wsdl.portTypes().iterator();
        if(portTypes.hasNext()){
          WsdlPortType newOperationPortType = portTypes.next();
          WsdlPortTypeOperation newOp = newOperationPortType.addOperation(node.getOperationName());
          XmlNamespace wsaNS = BUILDER.newNamespace("http://www.w3.org/2006/05/addressing/wsdl");
         
          newOp.setInput(newInputMessage.getName(),newInputMessage);
          String inputAction = serviceOperation.getInput().xml().attributeValue(wsaNS, "Action");
          newInputMessage.xml().setAttributeValue(wsaNS, "Action", inputAction);
                   
          if(newOutputMessage != null){
            newOp.setOutput(newOutputMessage.getName(), newOutputMessage);
            String outputAction = serviceOperation.getOutput().xml().attributeValue(wsaNS, "Action");
            newOutputMessage.xml().setAttributeValue(wsaNS, "Action", outputAction);
          }
        }
        servicePortType = wsdlPortType;
      }
     
     
     
      addreceive(workflow.getOdeProcess(null, null), wsdl, operationName, newInputMessage.getName() ) ;
    }
   
   
   
//    find the binding for the operation in the service wsdl
    Iterable<WsdlBinding> serviceBindings = serviceWSDL.bindings();
    WsdlBinding serviceBinding = null;
    for (WsdlBinding wsdlBinding : serviceBindings) {
      if(wsdlBinding.getPortType().equals(servicePortType.getQName())){
        serviceBinding = wsdlBinding;
        break;
      }
    }
    WsdlBindingOperation serviceBindingOperation = serviceBinding.getOperation(node.getOperationName());
   
    //find the binding in the final wsdl
    Iterator<WsdlPortType> portTypeItr = wsdl.portTypes().iterator();
    if(portTypeItr.hasNext()){
      WsdlPortType portType = portTypeItr.next();
      Iterable<WsdlBinding> bindings = wsdl.bindings();
      for (WsdlBinding wsdlBinding : bindings) {
        if(wsdlBinding.getPortType().equals(portType.getQName())){
          WsdlBindingOperation newBindingOperation = wsdlBinding.addOperation(node.getOperationName());
          Iterable serviceBindingChildren = serviceBindingOperation.xml().children();
          for (Object object : serviceBindingChildren) {
            if(object instanceof XmlElement){
              XmlElement newBindingOperationChild  = ((XmlElement)object).clone();
              newBindingOperation.xml().addElement(newBindingOperationChild);
             
              //if this is the input element add a header binding because that is missing in the
              // wsdl that this was copied from
              if("input".equals(newBindingOperationChild.getName())){
                XmlElement bindingBody = newBindingOperationChild.element("body");
                bindingBody.setAttributeValue("parts", "input");
                XmlNamespace soapNS = XmlConstants.BUILDER.newNamespace("http://schemas.xmlsoap.org/wsdl/soap/");
                XmlElement bindingHeader = newBindingOperationChild.addElement(soapNS, "header");
                bindingHeader.setAttributeValue("part", "leadHeader");
                bindingHeader.setAttributeValue("use", "literal");
                bindingHeader.setAttributeValue("message", "tns:"+newInputMessage.getName());
               
View Full Code Here


        newInputMessage);

  }

  private void addCorrelationProperties(WsdlDefinitions wsdl, WsdlMessage workflowInputMessage, WsdlMessage secondReceiveMessage) {
    XmlNamespace propns = BUILDER
        .newNamespace("http://docs.oasis-open.org/wsbpel/2.0/varprop");
   
    String tnsPrefix = wsdl.xml().lookupNamespaceByName(wsdl.getTargetNamespace()).getPrefix();

    XmlElement property = wsdl.xml().addElement(propns, "property");
    property.setAttributeValue("name", "experiment-id");
    property.setAttributeValue("type", "xsd:string");

    XmlElement propertyAlias = wsdl.xml().addElement(propns,
        "propertyAlias ");
    propertyAlias.setAttributeValue("propertyName", "tns:experiment-id");
   
    XmlNamespace bpelNS = BUILDER.newNamespace("bpel", "http://docs.oasis-open.org/wsbpel/2.0/process/executable");
    propertyAlias.setAttributeValue("messageType", tnsPrefix+":"+workflowInputMessage.getName());
    propertyAlias.setAttributeValue("part", "leadHeader");
    String corelationXpath = "/lc:experiment-id";
    XmlElement query = propertyAlias.addElement(bpelNS, "query");
    query.addChild(corelationXpath);
View Full Code Here

    org.xmlpull.infoset.XmlElement xml = workflowWsdl.xml();
    Iterator<XmlNamespace> itr = xml.namespaces().iterator();

    LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>();
    while (itr.hasNext()) {
      XmlNamespace ns = itr.next();
      if (!"http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
          .equals(ns.getName())) {
        namespaces.add(ns);
      }
    }

    xml.removeAllNamespaceDeclarations();

    for (XmlNamespace xmlNamespace : namespaces) {
      xml.declareNamespace(xmlNamespace);
    }

    xml.setAttributeValue("xmlns:plnk",
        "http://docs.oasis-open.org/wsbpel/2.0/plnktype");

    Iterator<org.xmlpull.infoset.XmlElement> plItr = xml.elements(null,
        "partnerLinkType").iterator();
    while (plItr.hasNext()) {
      org.xmlpull.infoset.XmlElement xmlElement = plItr.next();
      XmlNamespace plinkNs = BUILDER
          .newNamespace("http://docs.oasis-open.org/wsbpel/2.0/plnktype");
      xmlElement.setNamespace(plinkNs);
      Iterator childItr = xmlElement.children().iterator();
      while (childItr.hasNext()) {
        Object object = (Object) childItr.next();
View Full Code Here

      // Add the namespace to the lead context

      org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
      // get the ns of schema from existing element
      XmlNamespace schemaNs = BUILDER.newNamespace("xsd",
          "http://www.w3.org/2001/XMLSchema");

      addCrosscutImportsIfNecessary(wsdl);

      org.xmlpull.infoset.XmlElement schema = BUILDER.newFragment(
          schemaNs, SCHEMA);
      types.addElement(0, schema);

      org.xmlpull.infoset.XmlElement importElement = BUILDER.newFragment(
          schema.getNamespace(), IMPORT);
      importElement
          .setAttributeValue(NAMESPACE,
              LEAD_CONTEXT_HEADER_NS);
      importElement
          .setAttributeValue(SCHEMA_LOCATION,
              SCHEMA_LOCATION_URI);
      schema.addElement(0, importElement);

      wsdl.xml()
          .declareNamespace(
              BUILDER
                  .newNamespace(LC,
                      LEAD_CONTEXT_HEADER_NS));

      Iterator<WsdlPortType> iterator = wsdl.portTypes().iterator();
      while (iterator.hasNext()) {
        WsdlPortType portType = iterator.next();
        Iterator<WsdlPortTypeOperation> operations = portType
            .operations().iterator();
        while (operations.hasNext()) {
          WsdlPortTypeOperation operation = operations.next();
          WsdlMessagePart leadHeaderPart = new WsdlMessagePart(
              LEAD_HEADER);
          leadHeaderPart.setName(LEAD_HEADER);
          // we hand set this element to xml because when you use the
          // API it doent add the namespace correctly
          leadHeaderPart.xml().setAttributeValue(ELEMENT,
              LC_CONTEXT);

          wsdl.getMessage(
              operation.getInput().getMessage().getLocalPart())
              .addPart(leadHeaderPart);
        }
      }

      Iterator<WsdlBinding> bindingItr = wsdl.bindings().iterator();
      while (bindingItr.hasNext()) {
        WsdlBinding wsdlBinding = (WsdlBinding) bindingItr.next();
        Iterator<WsdlBindingOperation> operationsItr = wsdlBinding
            .operations().iterator();
        while (operationsItr.hasNext()) {
          WsdlBindingOperation wsdlBindingOperation = (WsdlBindingOperation) operationsItr
              .next();
          org.xmlpull.infoset.XmlElement input = wsdlBindingOperation
              .xml().element(INPUT);
          org.xmlpull.infoset.XmlElement body = input.element(BODY);
          if(body == null){
            //This is a HTTP binding so continue with the next
            continue;
           
          }
         
          body.setAttributeValue(PARTS, INPUT);
          XmlNamespace ns = body.getNamespace();

          org.xmlpull.infoset.XmlElement header = input.newElement(
              ns, HEADER);
          header.setAttributeValue(PART, LEAD_HEADER);
          header.setAttributeValue(USE, LITERAL);
View Full Code Here

   * @param types
   * @param schemaNs
   */
  private void addCrosscutImportsIfNecessary(WsdlDefinitions wsdl) {
    org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
    XmlNamespace schemaNs = BUILDER.newNamespace("xsd",
    "http://www.w3.org/2001/XMLSchema");
    Iterable<org.xmlpull.infoset.XmlElement> schemas = types.elements(null, SCHEMA);
    for (org.xmlpull.infoset.XmlElement schema : schemas) {
     
      if(WSDLUtil.attributeExist(schema, "type", "crosscutns:LeadCrosscutParameters")){
View Full Code Here

            // namespaces.
            schema
                .setNamespace(xsul5.XmlConstants.BUILDER
                    .newNamespace("http://www.w3.org/2001/XMLSchema"));
            while (itr.hasNext()) {
              XmlNamespace next = itr.next();
              if (!"".equals(next.getPrefix())
                  && null != next.getPrefix()) {
                schema.setAttributeValue("xmlns:"
                    + next.getPrefix(), next.getName());
              }

            }

            try {
View Full Code Here

            throw new IllegalStateException("NO Port found in the workflow WSDL:" + workflowName);
        }
        String targetNamespace = gpelProcess.getTargetNamespace();
        String targetNamespacePrefix = "wfns";

        XmlNamespace odeNs = builder.newNamespace("http://www.apache.org/ode/schemas/dd/2007/03");
        XmlElement deploy = builder.newFragment(odeNs, "deploy");
        deploy.declareNamespace(PROCESS, targetNamespace);
        deploy.declareNamespace(targetNamespacePrefix, workflowWSDL.getTargetNamespace());

        XmlElement process = deploy.addElement(odeNs, PROCESS);
View Full Code Here

        org.xmlpull.infoset.XmlElement xml = workflowWsdl.xml();
        Iterator<XmlNamespace> itr = xml.namespaces().iterator();

        LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>();
        while (itr.hasNext()) {
            XmlNamespace ns = itr.next();
            if (!"http://schemas.xmlsoap.org/ws/2004/03/partner-link/".equals(ns.getName())) {
                namespaces.add(ns);
            }
        }

        xml.removeAllNamespaceDeclarations();

        for (XmlNamespace xmlNamespace : namespaces) {
            xml.declareNamespace(xmlNamespace);
        }

        xml.setAttributeValue("xmlns:plnk", "http://docs.oasis-open.org/wsbpel/2.0/plnktype");

        Iterator<org.xmlpull.infoset.XmlElement> plItr = xml.elements(null, "partnerLinkType").iterator();
        while (plItr.hasNext()) {
            org.xmlpull.infoset.XmlElement xmlElement = plItr.next();
            XmlNamespace plinkNs = BUILDER.newNamespace("http://docs.oasis-open.org/wsbpel/2.0/plnktype");
            xmlElement.setNamespace(plinkNs);
            Iterator childItr = xmlElement.children().iterator();
            while (childItr.hasNext()) {
                Object object = (Object) childItr.next();
                if (object instanceof org.xmlpull.infoset.XmlElement) {
View Full Code Here

            // Add the namespace to the lead context

            org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
            // get the ns of schema from existing element
            XmlNamespace schemaNs = BUILDER.newNamespace("xsd", "http://www.w3.org/2001/XMLSchema");

            addCrosscutImportsIfNecessary(wsdl);

            org.xmlpull.infoset.XmlElement schema = BUILDER.newFragment(schemaNs, SCHEMA);
            types.addElement(0, schema);

            org.xmlpull.infoset.XmlElement importElement = BUILDER.newFragment(schema.getNamespace(), IMPORT);
            importElement.setAttributeValue(NAMESPACE, LEAD_CONTEXT_HEADER_NS);
            importElement.setAttributeValue(SCHEMA_LOCATION, SCHEMA_LOCATION_URI);
            schema.addElement(0, importElement);

            wsdl.xml().declareNamespace(BUILDER.newNamespace(LC, LEAD_CONTEXT_HEADER_NS));

            Iterator<WsdlPortType> iterator = wsdl.portTypes().iterator();
            while (iterator.hasNext()) {
                WsdlPortType portType = iterator.next();
                Iterator<WsdlPortTypeOperation> operations = portType.operations().iterator();
                while (operations.hasNext()) {
                    WsdlPortTypeOperation operation = operations.next();
                    WsdlMessagePart leadHeaderPart = new WsdlMessagePart(LEAD_HEADER);
                    leadHeaderPart.setName(LEAD_HEADER);
                    // we hand set this element to xml because when you use the
                    // API it doent add the namespace correctly
                    leadHeaderPart.xml().setAttributeValue(ELEMENT, LC_CONTEXT);

                    wsdl.getMessage(operation.getInput().getMessage().getLocalPart()).addPart(leadHeaderPart);
                }
            }

            Iterator<WsdlBinding> bindingItr = wsdl.bindings().iterator();
            while (bindingItr.hasNext()) {
                WsdlBinding wsdlBinding = (WsdlBinding) bindingItr.next();
                Iterator<WsdlBindingOperation> operationsItr = wsdlBinding.operations().iterator();
                while (operationsItr.hasNext()) {
                    WsdlBindingOperation wsdlBindingOperation = (WsdlBindingOperation) operationsItr.next();
                    org.xmlpull.infoset.XmlElement input = wsdlBindingOperation.xml().element(INPUT);
                    org.xmlpull.infoset.XmlElement body = input.element(BODY);
                    if (body == null) {
                        // This is a HTTP binding so continue with the next
                        continue;

                    }

                    body.setAttributeValue(PARTS, INPUT);
                    XmlNamespace ns = body.getNamespace();

                    org.xmlpull.infoset.XmlElement header = input.newElement(ns, HEADER);
                    header.setAttributeValue(PART, LEAD_HEADER);
                    header.setAttributeValue(USE, LITERAL);
                    String inputMessage = findInputMessage(wsdlBindingOperation, wsdl);
View Full Code Here

     *
     * @param wsdl
     */
    private void addCrosscutImportsIfNecessary(WsdlDefinitions wsdl) {
        org.xmlpull.infoset.XmlElement types = wsdl.getTypes();
        XmlNamespace schemaNs = BUILDER.newNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
        Iterable<org.xmlpull.infoset.XmlElement> schemas = types.elements(null, SCHEMA);
        for (org.xmlpull.infoset.XmlElement schema : schemas) {

            if (WSDLUtil.attributeExist(schema, "type", "crosscutns:LeadCrosscutParameters")) {
                // so its there now check whether the impport is already there
View Full Code Here

TOP

Related Classes of org.xmlpull.infoset.XmlNamespace

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.