Exemplo n.º 1
0
 private org.apache.woden.wsdl20.Description readWSDL2File()
     throws APIManagementException, WSDLException {
   WSDLReader reader = getWsdlFactoryInstance().newWSDLReader();
   reader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
   reader.setFeature("javax.wsdl.importDocuments", false);
   try {
     org.apache.woden.WSDLFactory wFactory = org.apache.woden.WSDLFactory.newInstance();
     org.apache.woden.WSDLReader wReader = wFactory.newWSDLReader();
     wReader.setFeature(org.apache.woden.WSDLReader.FEATURE_VALIDATION, true);
     //            wReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
     //            wReader.setFeature("javax.wsdl.importDocuments", false);
     return wReader.readWSDL(baseURI);
   } catch (org.apache.woden.WSDLException e) {
     String error = "Error occurred reading wsdl document.";
     log.error(error);
   }
   if (log.isDebugEnabled()) {
     log.debug("Reading  the WSDL. Base uri is " + baseURI);
   }
   return null;
 }
Exemplo n.º 2
0
  public OMElement readAndCleanWsdl2(API api) throws APIManagementException {

    try {
      org.apache.woden.wsdl20.Description wsdlDefinition = readWSDL2File();
      setServiceDefinitionForWSDL2(wsdlDefinition, api);
      org.apache.woden.WSDLWriter writer =
          org.apache.woden.WSDLFactory.newInstance().newWSDLWriter();
      ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
      writer.writeWSDL(wsdlDefinition.toElement(), byteArrayOutputStream);
      ByteArrayInputStream byteArrayInputStream =
          new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
      return APIUtil.buildOMElement(byteArrayInputStream);
      //            String wsdlDoc = toString(byteArrayInputStream);
    } catch (Exception e) {
      String msg = " Error occurs when change the addres URL of the WSDL";
      log.error(msg);
      throw new APIManagementException(msg, e);
    }
  }