Ejemplo n.º 1
0
  public List<PartBean> getPartsByFault(Fault fault) throws XmlException {
    logger.debug("start public List<PartBean> getPartsByFault(Fault fault)");
    List<PartBean> partBeanList = new ArrayList<PartBean>();
    List<Part> partList = fault.getParts();

    for (Part p : partList) {
      PartBean partBean = new PartBean();
      partBean.setPartQName(p.getPartQName());
      //			partBean.setDocumentation(p.getDocumentation().getContent());
      partBean.setOtherAttributes(p.getOtherAttributes());
      partBean.setOtherElements(p.getOtherElements());
      logger.debug("Part QName : " + p.getPartQName());

      // type( one Part have one Type)
      ITypeDAO typeDAO = new TypeDAO();
      TypeBean typeBean = new TypeBean();
      typeBean = typeDAO.getTypeByPart(p);
      partBean.setType(typeBean);

      // set Element ( one Part have one Element )
      IElementDAO elementDAO = new ElementDAO();
      ElementBean elementBean = new ElementBean();
      elementBean = elementDAO.getElementByPart(p);
      partBean.setElement(elementBean);
      partBeanList.add(partBean);
    }
    logger.debug("end public List<PartBean> getPartsByFault(Fault fault)");
    return partBeanList;
  }
Ejemplo n.º 2
0
  public ElementBean getElementByFault(Fault fault) throws XmlException {
    ElementBean elementBean = new ElementBean();
    Element element = fault.getElement();
    if (element != null) {
      elementBean.setQname(element.getQName());
      //	elementBean.setDocumentation(element.getDocumentation().getContent());
      elementBean.setForm(element.getForm());
      elementBean.setMaxOccurs(element.getMaxOccurs());
      elementBean.setMinOccurs(element.getMinOccurs());
      elementBean.setOtherAttributes(element.getOtherAttributes());
      elementBean.setRef(element.getRef());

      ITypeDAO typeDAO = new TypeDAO();
      TypeBean typeBean = new TypeBean();
      typeBean = typeDAO.getTypeByElement(element);
      elementBean.setType(typeBean);
    }
    logger.debug("end public List<ElementBean> getElementByFault(Fault fault)");
    return elementBean;
  }
Ejemplo n.º 3
0
  public Binding createDefaultSoapBinding(
      String bindingName, Endpoint endpoint, InterfaceType itf) {
    // create binding
    Binding binding = (Binding) ((AbstractInterfaceTypeImpl) itf).getDescription().createBinding();
    binding.setQName(
        new QName(
            ((AbstractInterfaceTypeImpl) itf).getDescription().getTargetNamespace(), bindingName));
    binding.setInterface(itf);
    binding.setTransportProtocol(
        org.ow2.easywsdl.wsdl.impl.wsdl11.Constants.HTTP_SCHEMAS_XMLSOAP_ORG_SOAP_HTTP);

    for (Operation operation : itf.getOperations()) {
      BindingOperation bindingOperation = binding.createBindingOperation();
      bindingOperation.setQName(operation.getQName());

      // We set soapAction attribut as an URI build from the operation
      // qualified name.
      bindingOperation.setSoapAction(
          operation.getQName().getNamespaceURI()
              + (operation.getQName().getNamespaceURI().endsWith("/") ? "" : "/")
              + operation.getQName().getLocalPart());

      // input
      if (operation.getInput() != null) {
        BindingInput binput = bindingOperation.createInput();
        bindingOperation.setInput(binput);
        SOAP11Binding4Wsdl11 soap11binding = binput.createSOAP11Binding4Wsdl11();

        SOAP11Body body = soap11binding.createBody();
        body.setUse(UseConstants.LITERAL);
        try {
          soap11binding.setBody(body);
        } catch (WSDLException e) {
          // do nothing
        }
        binput.setSOAP11Binding4Wsdl11(soap11binding);
      }

      // output
      if (operation.getOutput() != null) {
        BindingOutput boutput = bindingOperation.createOutput();
        bindingOperation.setOutput(boutput);
        SOAP11Binding4Wsdl11 soap11binding = boutput.createSOAP11Binding4Wsdl11();

        SOAP11Body body = soap11binding.createBody();
        body.setUse(UseConstants.LITERAL);
        try {
          soap11binding.setBody(body);
        } catch (WSDLException e) {
          // do nothing
        }
        boutput.setSOAP11Binding4Wsdl11(soap11binding);
      }

      // fault
      if (operation.getFaults() != null) {
        for (Fault faultop : operation.getFaults()) {
          BindingFault bfault = bindingOperation.createFault();
          bfault.setName(faultop.getName());
          bindingOperation.addFault(bfault);
          SOAP11Binding4Wsdl11 soap11binding = bfault.createSOAP11Binding4Wsdl11();

          SOAP11Fault soap11fault = soap11binding.createFault();
          soap11fault.setName(faultop.getName());
          soap11fault.setUse(UseConstants.LITERAL);
          try {
            soap11binding.setFault(soap11fault);
          } catch (WSDLException e) {
            // do nothing
          }
          bfault.setSOAP11Binding4Wsdl11(soap11binding);
        }
      }

      binding.addBindingOperation(bindingOperation);
    }

    // set the binding to endpoint
    endpoint.setBinding(binding);

    return binding;
  }