Package xsul5.wsdl

Examples of xsul5.wsdl.WsdlDefinitions


   
   
   
    WSNode node = (WSNode)activeNode;
    WsdlDefinitions serviceWSDL = workflow.getWSDLs().get(node.getWSDLID());
    XmlElement serviceSchema = serviceWSDL.getTypes().element(null, "schema");
    String serviceTns = serviceSchema.attributeValue("targetNamespace");
   
    String nsPrefix = null;
    String oldNSPrefix = null;
    boolean introduceNewNS = false;
    String operationName = node.getOperationName();
    WsdlMessage newInputMessage = null;
    Iterable<WsdlPortType> servicePortTypes = serviceWSDL.portTypes();
    WsdlPortTypeOperation serviceOperation = null;
    WsdlPortType servicePortType = null;
    for (WsdlPortType wsdlPortType : servicePortTypes) {
     
      serviceOperation = wsdlPortType.getOperation(operationName);
      if(serviceOperation != null){
        QName inputMessageName = serviceOperation.getInput().getMessage();
        WsdlMessagePart part = WSDLUtil.getfirst(serviceWSDL.getMessage(inputMessageName.getLocalPart()).parts());
       
        nsPrefix = part.getElement().getPrefix();
        oldNSPrefix = nsPrefix;
        introduceNewNS = false;
        while( null != wsdl.xml().lookupNamespaceByPrefix(nsPrefix)){
          //this namespace is already there so keep adding control at the end and check for
          //its existance
          nsPrefix += "_control";
          introduceNewNS = true;
        }
       
        wsdl.xml().declareNamespace(BUILDER.newNamespace(nsPrefix, serviceTns));
       
       
        WsdlMessage inputMessage = serviceWSDL.getMessage(inputMessageName.getLocalPart());
        newInputMessage = wsdl.addMessage(inputMessageName.getLocalPart());
        Iterable<WsdlMessagePart> parts = inputMessage.parts();
        for (WsdlMessagePart wsdlMessagePart : parts) {
          XmlElement newPart = null;
          if(introduceNewNS){
            XmlElement clone = wsdlMessagePart.xml().clone();
            String xmlAsString = BUILDER.serializeToString(clone).replaceAll(oldNSPrefix+":", nsPrefix+":");
            newPart= BUILDER.parseFragmentFromString(xmlAsString);
          }else{
            newPart = wsdlMessagePart.xml().clone();
          }
          newInputMessage.xml().addElement(newPart);
        }
        //add lead header part to the new input messag because this message is copied from the service wsdl.
       
        XmlElement newLeadHeaderPart = newInputMessage.xml().addElement(newInputMessage.xml().getNamespace(), "part");
        newLeadHeaderPart.setAttributeValue("name", "leadHeader");
        newLeadHeaderPart.setAttributeValue("element", "lc:context");
       
        WsdlMessage newOutputMessage = null;
        if(null != serviceOperation.getOutput()){
          QName outputMessageName = serviceOperation.getOutput().getMessage();
          WsdlMessage outputMessage = serviceWSDL.getMessage(outputMessageName.getLocalPart());
          newOutputMessage = wsdl.addMessage(outputMessageName.getLocalPart());
          Iterable<WsdlMessagePart> parts2 = outputMessage.parts();
          for (WsdlMessagePart wsdlMessagePart : parts2) {
            XmlElement newPart = null;
            if(introduceNewNS){
              XmlElement clone = wsdlMessagePart.xml().clone();
              String xmlAsString = BUILDER.serializeToString(clone).replaceAll(oldNSPrefix+":", nsPrefix+":");
              newPart = BUILDER.parseFragmentFromString(xmlAsString);
            }else{
              newPart = wsdlMessagePart.xml().clone();
            }
            newOutputMessage.xml().addElement(newPart);
          }
        }
       
       
       
       
        if(introduceNewNS){
          List<XmlNamespace> namespacesPresentInSchema = WSDLUtil.getNamespaces(serviceSchema);
          WSDLUtil.print(serviceSchema);
          for (XmlNamespace shouldBeDefinedNamespaces : namespacesPresentInSchema) {
            if(shouldBeDefinedNamespaces.getPrefix() != null &&
                null == wsdl.xml().lookupNamespaceByPrefix(shouldBeDefinedNamespaces.getPrefix())){
              wsdl.xml().declareNamespace(shouldBeDefinedNamespaces);
            }
           
          }
          XmlElement clone = serviceSchema.clone();
          String xmlAsString = BUILDER.serializeToString(clone).replaceAll(oldNSPrefix+":", nsPrefix+":");
          XmlElement newSchema= BUILDER.parseFragmentFromString(xmlAsString);
          types.addChild(newSchema);
         
          XmlElement crosscutImport = BUILDER.newFragment(newSchema.getNamespace(), "import");
          crosscutImport.setAttributeValue("namespace", "http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/");
          crosscutImport.setAttributeValue("schemaLocation", "lead-crosscut-parameters.xsd");
          newSchema.addChild(0, crosscutImport);
        }else{
          types.addChild(serviceSchema.clone());
        }
        //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;
View Full Code Here


  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

    /**
     *
     */
    public void estWSIFINvoker() {
        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(
                new File(SAMPLE_AWSDL).toURI());

        WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
        WSIFService service = factory.getService(WSDLUtil
                .wsdlDefinitions5ToWsdlDefintions3(definitions));
View Full Code Here

        // WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(
        // new File(SAMPLE_AWSDL).toURI());

        AdderService service = new AdderService();
        service.run();
        WsdlDefinitions definitions = WSDLUtil
                .wsdlDefinitions3ToWsdlDefintions5(service.getWsdl());

        if (WSDLUtil.isAWSDL(definitions)) {
            DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
        }

        logger.info(definitions.xmlStringPretty());

        // Create lead context.
        LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
        leadContextHelper.setXBayaConfiguration(this.configuration);
        LeadContextHeader leadContext = leadContextHelper
View Full Code Here

     */
    public void estWithUserCredential() throws ComponentException, IOException,
            GeneralSecurityException {
        boolean userCred = true;
        GSSCredential proxy = null;
        WsdlDefinitions wsdl = null; // Set WSDL of the workflow.
        LeadContextHeader leadContext = null; // Set the LEAD Context.
        URI messageBoxURL = null; // This one can be null;

        String trustedcerts = System.getProperty("trustedcerts");
        String certskey = System.getProperty("certskey");
View Full Code Here

  }

  public static void main(String[] args) throws WsdlException,
      URISyntaxException {
    WsdlDefinitions streamEngine = WsdlResolver
        .getInstance()
        .loadWsdl(
            new URI(
                "http://pagodatree.cs.indiana.edu:9999/axis2/services/StreamEngine?wsdl"));
    WSDLCleaner.cleanWSDL(streamEngine);
View Full Code Here

  // System.out.println("Didnt receive the responce from CEPService yet");
  // }
  // }
  private void registerQuery(List<WSComponentPort> inputs, String workflowname)
      throws URISyntaxException {
    WsdlDefinitions streamEngine = WsdlResolver
        .getInstance()
        .loadWsdl(
            new URI(
                "http://pagodatree.cs.indiana.edu:9999/axis2/services/StreamEngine?wsdl"));
    WSDLCleaner.cleanWSDL(streamEngine);
View Full Code Here

   */
  public static WsdlDefinitions stringToWSDL(String wsdlString)
      throws ComponentException {
    try {
      XmlElement wsdlElement = XMLUtil.stringToXmlElement(wsdlString);
      WsdlDefinitions definitions = new WsdlDefinitions(wsdlElement);
      return definitions;
    } catch (RuntimeException e) {
      throw new ComponentException(e);
    }
  }
View Full Code Here

      // leadContext)).useAsyncMessaging(correlator)
      // .setAsyncResponseTimeoutInMs(33000L); // to simplify testing

      //FIXME Chathura
      //This was done to mitigate the issue in the duel network cards.
      WsdlDefinitions proxyWSDL = xsul5.wsdl.WsdlResolver.getInstance().loadWsdl(engineURL);
     
     
//      WsdlService proxyService = WSDLUtil.getfirst(proxyWSDL.services());
//      WsdlPort proxyPort = WSDLUtil.getfirst(proxyService.ports());
//      org.xmlpull.infoset.XmlElement address = proxyPort.xml().element("address");
//      XmlAttribute location = address.attribute("location");
//      address.removeAttribute(location);
//      address.setAttributeValue("location", engineURL.toString().substring(0, engineURL.toString().indexOf("?wsdl")));
     
//      WSIFService service = WSIFServiceFactory.newInstance().getService(
//          WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(proxyWSDL) );
//            WSIFPort port = service.getPort();
//            WSIFClient wclient = WSIFRuntime.getDefault().newClientFor(port);
           
      WSIFClient wclient = WSIFRuntime.newClient(engineURL.toString())
          .addHandler(
              new StickySoapHeaderHandler("use-lead-header",
                  leadContext)).useAsyncMessaging(correlator)
          .setAsyncResponseTimeoutInMs(33000L); // to simplify testing
      // set to just few
      // seconds

      WSIFPort port = wclient.getPort();
      WSIFOperation operation = port.createOperation("deploy");

      WSIFMessage outputMessage = operation.createOutputMessage();
      WSIFMessage faultMessage = operation.createFaultMessage();
      XmlElement inputMessageElement = xmlObjectToEl(getDeploymentPayload(
          workflow, this.xbayaEngine.getConfiguration().getDSCURL()));
      WSIFMessage inputMessage = new WSIFMessageElement(
          inputMessageElement);

      System.out.println("Sending a message:\n"
          + XMLUtil.xmlElementToString((XmlElement) inputMessage));
      boolean success = operation.executeRequestResponseOperation(
          inputMessage, outputMessage, faultMessage);

      XmlElement result;
      if (success) {
        result = (XmlElement) outputMessage;
      } else {
        throw new XsulException(faultMessage.toString());

      }

    } catch (IOException e) {
      throw new WorkflowProxyException(e);

    } catch (XmlBuilderException e) {
      throw new WorkflowProxyException(e);
    } catch (GraphException e) {
      throw new WorkflowProxyException(e);
    } catch (ComponentException e) {
      throw new WorkflowProxyException(e);
    }
    XBayaConfiguration configuration = this.xbayaEngine.getConfiguration();
    WsdlDefinitions workflowWSDL;
    try {
      workflowWSDL = workflow.getOdeWorkflowWSDL(configuration
          .getDSCURL(), configuration.getODEURL());
    } catch (Exception e) {
      // shouldnt happen cos we have already called this once
      throw new XBayaRuntimeException(e);
    }
    org.xmlpull.infoset.XmlElement service = workflowWSDL.xml().element(
        null, "service");
    org.xmlpull.infoset.XmlElement port = service.element(null, "port");
    org.xmlpull.infoset.XmlElement address = port.element(null, "address");
    String location = address.attributeValue("location");
View Full Code Here

  /**
   * @param definitions
   * @return The cloned WsdlDefinitions
   */
  public static WsdlDefinitions deepClone(WsdlDefinitions definitions) {
    return new WsdlDefinitions(XMLUtil.deepClone(definitions.xml()));
  }
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.