当前位置: 首页>>代码示例>>Java>>正文


Java WSDLReader类代码示例

本文整理汇总了Java中javax.wsdl.xml.WSDLReader的典型用法代码示例。如果您正苦于以下问题:Java WSDLReader类的具体用法?Java WSDLReader怎么用?Java WSDLReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WSDLReader类属于javax.wsdl.xml包,在下文中一共展示了WSDLReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPortTypeOperations

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
/**
 * 参考SoapMessageBuilder.SoapMessageBuilder(URL wsdlUrl)方法
 * 获取portType中的所有operation
 *
 * @param wsdlUrl
 * @return
 */
private static List<Operation> getPortTypeOperations(String wsdlUrl) {
    List<Operation> operationList = new ArrayList();
    try {
        WSDLReader reader = new WSDLReaderImpl();
        reader.setFeature("javax.wsdl.verbose", false);
        Definition definition = reader.readWSDL(wsdlUrl.toString());
        Map<String, PortTypeImpl> defMap = definition.getAllPortTypes();
        Collection<PortTypeImpl> collection = defMap.values();
        for (PortTypeImpl portType : collection) {
            operationList.addAll(portType.getOperations());
        }
    } catch (WSDLException e) {
        System.out.println("get wsdl operation fail.");
        e.printStackTrace();
    }
    return operationList;
}
 
开发者ID:wuxinshui,项目名称:boosters,代码行数:25,代码来源:OperatonUtils.java

示例2: validateVersion

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
void validateVersion(String wsdlUrl) {
    WSDLLocator locator = new BasicAuthWSDLLocator(wsdlUrl, null, null);
    WSDLFactory wsdlFactory;
    Definition serviceDefinition;
    try {
        wsdlFactory = WSDLFactory.newInstance();
        WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
        // avoid importing external documents
        wsdlReader.setExtensionRegistry(new WSVersionExtensionRegistry());
        serviceDefinition = wsdlReader.readWSDL(locator);
        Element versionElement = serviceDefinition
                .getDocumentationElement();
        if (!CTMGApiVersion.version.equals(versionElement.getTextContent())) {
            LOGGER.warn("Web service mismatches and the version value, expected: "
                    + CTMGApiVersion.version
                    + " and the one got from wsdl: "
                    + versionElement.getTextContent());
        }
    } catch (WSDLException e) {
        LOGGER.warn("Remote wsdl cannot be retrieved from CT_MG. [Cause: "
                + e.getMessage() + "]", e);
    }

}
 
开发者ID:servicecatalog,项目名称:development,代码行数:25,代码来源:BesDAO.java

示例3: testWsdl

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
@Test
@RunAsClient
public void testWsdl() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/jaxws-jbws2183/TestServiceImpl?wsdl");
   WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
   Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
   assertNotNull(wsdlDefinition);
   for (Iterator<?> it = wsdlDefinition.getAllBindings().values().iterator(); it.hasNext(); )
   {
      List<?> extElements = ((Binding)it.next()).getExtensibilityElements();
      boolean found = false;
      for (int i = 0; i < extElements.size(); i++)
      {
         ExtensibilityElement extElement = (ExtensibilityElement)extElements.get(i);
         if (extElement instanceof SOAP12Binding)
            found = true;
         else if (extElement instanceof SOAPBinding)
            fail("SOAP 1.1 Binding found!");
      }
      assertTrue("SOAP 1.2 Binding not found!",found);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:24,代码来源:JBWS2183TestCase.java

示例4: test

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
@Test
@RunAsClient
public void test() throws Exception
{
   File destDir = new File(TEST_DIR, "wsprovide" + FS + "java");
   String absOutput = destDir.getAbsolutePath();
   String command = JBOSS_HOME + FS + "bin" + FS + "wsprovide" + EXT + " -k -w -o " + absOutput + " --classpath " + CLASSES_DIR + " " + ENDPOINT_CLASS;
   Map<String, String> env = new HashMap<>();
   env.put("JAVA_OPTS", System.getProperty("additionalJvmArgs"));
   executeCommand(command, null, "wsprovide", env);

   URL wsdlURL = new File(destDir, "JBWS2528EndpointService.wsdl").toURI().toURL();
   WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
   Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
   PortType portType = wsdlDefinition.getPortType(new QName("http://jbws2528.jaxws.ws.test.jboss.org/", "JBWS2528Endpoint"));
   Operation op = (Operation)portType.getOperations().get(0);
   @SuppressWarnings("unchecked")
   List<String> parOrder = op.getParameterOrdering();
   assertEquals("id", parOrder.get(0));
   assertEquals("Name", parOrder.get(1));
   assertEquals("Employee", parOrder.get(2));
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:23,代码来源:JBWS2528TestCase.java

示例5: getWSDL11Parser

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
public static synchronized WSDL11Parser getWSDL11Parser(String wsdlLocation) throws WSDLException, IOException {
    WSDL11Parser parser = null;
    
    if (parsers == null) {
        parsers = new TreeMap<String, WSDL11Parser>();
    } else {
        parser = parsers.get(wsdlLocation);
    }
    
    if (parser == null) {
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", false);
        Definition definition = reader.readWSDL(wsdlLocation);

        parser = new WSDL11Parser(definition);
        
        parsers.put(wsdlLocation, parser);
    }
    
    return parser;
}
 
开发者ID:apache,项目名称:incubator-taverna-common-activities,代码行数:23,代码来源:WSDL11Parser.java

示例6: readWSDL

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
/**
 * Read the WSDL document and create a WSDL Definition.
 *
 * @param wsdlLocation location pointing to a WSDL XML definition.
 * @return the Definition.
 * @throws WSDLException If unable to read the WSDL
 */
public static Definition readWSDL(final String wsdlLocation) throws WSDLException {
    InputStream inputStream = null;
    try {
        URL url = getURL(wsdlLocation);
        inputStream = url.openStream();
        InputSource source = new InputSource(inputStream);
        source.setSystemId(url.toString());
        Document wsdlDoc = XMLHelper.getDocument(source);
        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
        WSDLReader reader = wsdlFactory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", false);
        return reader.readWSDL(url.toString(), wsdlDoc);
    } catch (Exception e) {
        throw new WSDLException(WSDLException.OTHER_ERROR,
                SOAPMessages.MESSAGES.unableToReadWSDL(wsdlLocation), e);
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException ioe) {
                LOGGER.error(ioe);
            }
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:33,代码来源:WSDLUtil.java

示例7: createWSDLDefinition

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
static Definition createWSDLDefinition(URL wsdlURL) {
    Definition wsdlDefinition = null;
    try {
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        wsdlDefinition = reader.readWSDL(wsdlURL.toString());
    }
    catch (Exception e) {
        TestLogger.logger
                .debug("*** ERROR ***: Caught exception trying to create WSDL Definition: " +
                        e);
        e.printStackTrace();
    }

    return wsdlDefinition;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:DescriptionTestUtils2.java

示例8: createWSDLDefinition

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
static public Definition createWSDLDefinition(URL wsdlURL) {
    Definition wsdlDefinition = null;
    try {
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        wsdlDefinition = reader.readWSDL(wsdlURL.toString());
        wsdlDefinition.setDocumentBaseURI(wsdlURL.toString());
    }
    catch (Exception e) {
        System.out.println(
                "*** ERROR ***: Caught exception trying to create WSDL Definition: " + e);
        e.printStackTrace();
    }

    return wsdlDefinition;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:DescriptionTestUtils.java

示例9: readInTheWSDLFile

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
/**
 * Read the WSDL file
 *
 * @param uri
 * @throws WSDLException
 */
public Definition readInTheWSDLFile(final String uri) throws WSDLException {

    WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
    reader.setFeature("javax.wsdl.importDocuments", true);

    ExtensionRegistry extReg = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
    extReg.registerExtensionAttributeType(Input.class,
            new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION),
            AttributeExtensible.STRING_TYPE);
    extReg.registerExtensionAttributeType(Output.class,
            new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION),
            AttributeExtensible.STRING_TYPE);
    reader.setExtensionRegistry(extReg);

    return reader.readWSDL(uri);
    
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:24,代码来源:CodeGenerationEngine.java

示例10: getWSDLComparison

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
/**
 * This method is used to get wsdl difference comparison.
 *
 * @param WSDLOne   wsdl one.
 * @param WSDLTwo   wsdl two.
 * @return          Comparison object which includes the difference parameters.
 * @throws ComparisonException
 * @throws WSDLException
 * @throws RegistryException
 * @throws UnsupportedEncodingException
 */
private Comparison getWSDLComparison(Resource WSDLOne, Resource WSDLTwo)
        throws ComparisonException, WSDLException, RegistryException, UnsupportedEncodingException {
    GovernanceDiffGeneratorFactory diffGeneratorFactory = new GovernanceDiffGeneratorFactory();
    DiffGenerator flow = diffGeneratorFactory.getDiffGenerator();
    if (flow != null) {
        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();

        InputSource inputSourceOne = new InputSource(new ByteArrayInputStream((byte[]) WSDLOne.getContent()));
        Definition originalWSDL = wsdlReader.readWSDL(null, inputSourceOne);

        InputSource inputSourceTwo = new InputSource(new ByteArrayInputStream((byte[]) WSDLTwo.getContent()));
        Definition changedWSDL = wsdlReader.readWSDL(null, inputSourceTwo);

        return flow.compare(originalWSDL, changedWSDL, ComparatorConstants.WSDL_MEDIA_TYPE);
    } else {
        return null;
    }
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:30,代码来源:ComparatorUtils.java

示例11: readWsdl

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
private Definition readWsdl(WSDLReader wsdlReader, String uri, String username, String password) 
    throws WSDLException, KettleException, AuthenticationException {
              
    try {
        HTTPProtocol http = new HTTPProtocol();
        Document doc = XMLHandler.loadXMLString(http.get(wsdlURI.toString(), username, password), true, false);
        if (doc != null) {
           return(wsdlReader.readWSDL(doc.getBaseURI(), doc));
        }
        else {
            throw new KettleException("Unable to get document.");
        }
    }
    catch (MalformedURLException mue) {
        throw new KettleException(mue);
    }
    catch (AuthenticationException ae) {
        //  re-throw this.  If not IOException seems to catch it
        throw ae;
    }
    catch (IOException ioe) {
        throw new KettleException(ioe);
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:25,代码来源:Wsdl.java

示例12: buildserviceinformation

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
public ServiceInfo buildserviceinformation(ServiceInfo serviceinfo)
		throws Exception{
	WSDLReader reader=wsdlFactory.newWSDLReader();
	Definition def=reader.readWSDL(serviceinfo.getWsdllocation());
	
	wsdlTypes = createSchemaFromTypes(def);
	System.out.println("WSDL的Schema已经成功构建完,总共有多少个Schema定义:"+wsdlTypes.size());
	
	Map services=def.getServices();
	if (services!= null) {
		Iterator svcIter = services.values().iterator();
		populateComponent(serviceinfo, (Service) svcIter.next());
		System.out.println("***恭喜您!系统的Web服务对象:ServiceInfo已经成功构建***");
		System.out.println("");
	}
	return serviceinfo;
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:18,代码来源:ComponentBuilder.java

示例13: readWsdl

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
private Definition readWsdl( WSDLReader wsdlReader, String uri, String username, String password ) throws WSDLException, KettleException, AuthenticationException {

    try {
      HTTPProtocol http = new HTTPProtocol();
      Document doc = XMLHandler.loadXMLString( http.get( wsdlURI.toString(), username, password ), true, false );
      if ( doc != null ) {
        return ( wsdlReader.readWSDL( doc.getBaseURI(), doc ) );
      } else {
        throw new KettleException( "Unable to get document." );
      }
    } catch ( MalformedURLException mue ) {
      throw new KettleException( mue );
    } catch ( AuthenticationException ae ) {
      // re-throw this. If not IOException seems to catch it
      throw ae;
    } catch ( IOException ioe ) {
      throw new KettleException( ioe );
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:20,代码来源:Wsdl.java

示例14: readWsdl

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
public static Definition readWsdl(URL wsdlURL) {
	Definition definition = null;
	try {
		if (wsdlURL != null) {
			WSDLFactory factory = WSDLFactory.newInstance();
			WSDLReader reader = factory.newWSDLReader();
			//reader.setFeature("javax.wsdl.importDocuments", true);
			definition = reader.readWSDL(null, wsdlURL.toString());
		}
	}
	catch (Throwable t) {
		Engine.logEngine.error("(WSDLUtils) error while reading WSDL", t);
	}
	return definition;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:16,代码来源:WSDLUtils.java

示例15: parseWSDLDefinition

import javax.wsdl.xml.WSDLReader; //导入依赖的package包/类
/**
 * Parse the WSDL definition using WSDL4J.
 */
protected Definition parseWSDLDefinition() throws WSDLException {
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader reader = wsdlFactory.newWSDLReader();
    reader.setFeature("javax.wsdl.verbose", false);
    reader.setFeature("javax.wsdl.importDocuments", true);
    Definition definition = reader.readWSDL(this.wsdlLocation);
    return definition;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:WSDLImporter.java


注:本文中的javax.wsdl.xml.WSDLReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。