java使用wsdlreader,Java WSDLReader.setFeature方法代碼示例

本文整理匯總了Java中javax.wsdl.xml.WSDLReader.setFeature方法的典型用法代碼示例。如果您正苦於以下問題:Java WSDLReader.setFeature方法的具體用法?Java WSDLReader.setFeature怎麽用?Java WSDLReader.setFeature使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.wsdl.xml.WSDLReader的用法示例。

在下文中一共展示了WSDLReader.setFeature方法的21個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: getPortTypeOperations

​點讚 4

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* 參考SoapMessageBuilder.SoapMessageBuilder(URL wsdlUrl)方法

* 獲取portType中的所有operation

*

* @param wsdlUrl

* @return

*/

private static List getPortTypeOperations(String wsdlUrl) {

List operationList = new ArrayList();

try {

WSDLReader reader = new WSDLReaderImpl();

reader.setFeature("javax.wsdl.verbose", false);

Definition definition = reader.readWSDL(wsdlUrl.toString());

Map defMap = definition.getAllPortTypes();

Collection 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,

示例2: getWSDL11Parser

​點讚 3

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();

} 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,

示例3: readWSDL

​點讚 3

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,

示例4: readInTheWSDLFile

​點讚 3

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,

示例5: parseWSDLDefinition

​點讚 2

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,

示例6: getAllBindingOperation

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* 參考SoapMessageBuilder.SoapMessageBuilder(URL wsdlUrl)方法

* 獲取binding節點的所有operation

*

* @param wsdlUrl

* @return

*/

public static List getAllBindingOperation(String wsdlUrl) {

List operationList = new ArrayList();

List nameList = new ArrayList();

try {

WSDLReader reader = new WSDLReaderImpl();

reader.setFeature("javax.wsdl.verbose", false);

Definition definition = reader.readWSDL(wsdlUrl.toString());

Map defMap = definition.getAllBindings();

Collection collection = defMap.values();

for (BindingImpl binding : collection) {

operationList.addAll(binding.getBindingOperations());

}

for (BindingOperation operation:operationList) {

nameList.add(operation.getName());

}

} catch (WSDLException e) {

System.out.println("get wsdl operation fail.");

e.printStackTrace();

}

return nameList;

}

開發者ID:wuxinshui,項目名稱:boosters,代碼行數:29,

示例7: get

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

public synchronized Definition get( String url )

throws WSDLException

{

Definition definition = cache.get( url );

if ( definition == null ) {

WSDLReader reader = factory.newWSDLReader();

reader.setFeature( "javax.wsdl.verbose", false );

definition = reader.readWSDL( url );

cache.put( url, definition );

}

return definition;

}

開發者ID:jolie,項目名稱:jolie,代碼行數:13,

示例8: getWSDLDefinition

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private Definition getWSDLDefinition(String wsdlLocation) throws Exception

{

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader wsdlReader = wsdlFactory.newWSDLReader();

wsdlReader.setFeature("javax.wsdl.importDocuments", false);

wsdlReader.setFeature("javax.wsdl.verbose", false);

Definition definition = wsdlReader.readWSDL(null, wsdlLocation);

return definition;

}

開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:11,

示例9: parseWSDLDefinition

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* Parse the WSDL definition using WSDL4J.

*/

private 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:logicalhacking,項目名稱:SecureBPMN,代碼行數:12,

示例10: getDefinition

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

public static Definition getDefinition(IFile pathToWsdl) throws CoreException {

try {

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();

newWSDLReader.setExtensionRegistry(wsdlFactory.newPopulatedExtensionRegistry());

newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);

return newWSDLReader.readWSDL(pathToWsdl.getLocationURI().toString());

} catch (WSDLException e) {

throw getCoreException(null, e);

}

}

開發者ID:Talend,項目名稱:tesb-studio-se,代碼行數:13,

示例11: load

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

public static Definition load(String wsdlLocation, String filenamePrefix) throws InvocationTargetException, WSDLException {

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();

newWSDLReader.setExtensionRegistry(wsdlFactory.newPopulatedExtensionRegistry());

newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);

return newWSDLReader.readWSDL(new InMemoryWSDLLocator(wsdlLocation, new WSDLLoader().load(wsdlLocation, filenamePrefix

+ "%d.wsdl")));

}

開發者ID:Talend,項目名稱:tesb-studio-se,代碼行數:10,

示例12: setUp

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

protected void setUp() throws Exception {

super.setUp();

WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();

reader.setFeature("javax.wsdl.importDocuments", false);

reader.setFeature("javax.wsdl.verbose", false);

URL wsdlFile = new File(AbstractTestCase.basedir + testWSDLFile)

.toURL();//getClass().getClassLoader().getResource(testWSDLFile);

definition = reader.readWSDL(wsdlFile.toString());

}

開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:11,

示例13: configureReaderInstance

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* This will be called to configure the WSDLReader instance.

*/

public void configureReaderInstance(WSDLReader reader) throws WSDLException

{

// prevent the WSDLReader instance from using the System.out

// stream for messages and logging

reader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);

}

開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:10,

示例14: getReader

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* Get a WSDLReader.

*

* @return WSDLReader.

* @throws WSDLException on error.

*/

private WSDLReader getReader() throws WSDLException {

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader wsdlReader = wsdlFactory.newWSDLReader();

ExtensionRegistry registry = wsdlFactory.newPopulatedExtensionRegistry();

wsdlReader.setExtensionRegistry(registry);

wsdlReader.setFeature("javax.wsdl.verbose", true);

wsdlReader.setFeature("javax.wsdl.importDocuments", true);

return wsdlReader;

}

開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:17,

示例15: readWsdl

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private static Definition readWsdl(String wsdlUrl, boolean verbose, boolean resolveImports) {

try {

WSDLFactory factory = WSDLFactory.newInstance();

WSDLReader reader = factory.newWSDLReader();

reader.setFeature(Constants.FEATURE_VERBOSE, verbose);

reader.setFeature(Constants.FEATURE_IMPORT_DOCUMENTS, resolveImports);

return reader.readWSDL(wsdlUrl);

} catch (WSDLException ex) {

throw new RuntimeException(ex);

}

}

開發者ID:whummer,項目名稱:service-prefetching,代碼行數:12,

示例16: parseServiceWSDL

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

public static Definition parseServiceWSDL(String wsdlLocation) throws WSDLException {

WSDLFactory factory = WSDLFactory.newInstance();

WSDLReader wsdlReader = factory.newWSDLReader();

wsdlReader.setFeature("javax.wsdl.verbose", LOG.isDebugEnabled());

wsdlReader.setFeature("javax.wsdl.importDocuments", true);

Definition mainDefinition = wsdlReader.readWSDL(wsdlLocation);

return mainDefinition;

}

開發者ID:NCIP,項目名稱:cagrid-core,代碼行數:11,

示例17: scanArchive

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private static void scanArchive(InputStream in, boolean isWar, List messages) throws Exception {

JarInputStream jar = new JarInputStream(in);

JarEntry entry;

List wsImplementations = new ArrayList();

WSDLResources wsdlResources = new WSDLResources();

while ((entry = jar.getNextJarEntry()) != null) {

String name = entry.getName();

if ((!isWar || name.startsWith("WEB-INF/classes/")) && name.endsWith(".class")) {

new ClassReader(jar).accept(new WebServiceAnnotationExtractor(wsImplementations), 0);

} else if (!isWar && name.startsWith("META-INF/wsdl/")

|| isWar && name.startsWith("WEB-INF/wsdl/")) {

wsdlResources.add(name, IOUtils.toByteArray(jar));

}

}

WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();

wsdlReader.setFeature("javax.wsdl.verbose", false);

for (WebServiceImplementation wsImplementation : wsImplementations) {

String className = wsImplementation.getClassName();

String wsdlLocation = wsImplementation.getWsdlLocation();

if (wsdlLocation == null) {

messages.add("[" + className + "] No wsdlLocation specified");

} else {

try {

Definition definitions = wsdlReader.readWSDL(wsdlResources.getWsdl(wsdlLocation));

QName serviceQName = new QName(wsImplementation.getTargetNamespace(), wsImplementation.getServiceName());

Service service = definitions.getService(serviceQName);

if (service == null) {

messages.add("[" + className + "] Service " + serviceQName + " not found in WSDL");

} else if (service.getPort(wsImplementation.getPortName()) == null) {

messages.add("[" + className + "] Port " + wsImplementation.getPortName() + " not found in service " + serviceQName);

}

} catch (WSDLNotFoundException ex) {

messages.add("[" + className + "] Document not found or in wrong place: " + ex.getName());

}

}

}

}

開發者ID:veithen,項目名稱:visualwas,代碼行數:38,

示例18: getReader

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

/**

* Get a WSDLReader.

*

* @return WSDLReader.

* @throws WSDLException

* on error.

*/

private WSDLReader getReader() throws WSDLException {

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader wsdlReader = wsdlFactory.newWSDLReader();

ExtensionRegistry registry = wsdlFactory.newPopulatedExtensionRegistry();

wsdlReader.setExtensionRegistry( registry );

wsdlReader.setFeature( "javax.wsdl.verbose", true );

wsdlReader.setFeature( "javax.wsdl.importDocuments", true );

return wsdlReader;

}

開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:18,

示例19: validaWSDLFromURI

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private static WSDLValidationInfo validaWSDLFromURI(String uri) throws Exception {

InputStream inputStream = null;

try {

inputStream = new URL(uri).openStream();

ResourceBundle rb = ResourceBundle.getBundle("validatewsdl");

MessageGenerator messagegenerator = new MessageGenerator(rb);

DocumentBuilder db;

DocumentBuilderFactory dbf = getSecuredDocumentBuilder();

dbf.setNamespaceAware(true);

try {

db = dbf.newDocumentBuilder();

} catch (Exception e) {

dbf = DocumentBuilderFactory.newInstance();

db = dbf.newDocumentBuilder();

}

Document doc = db.parse(inputStream);

WSDLReader reader = new ExWSDLReaderImpl(

(com.ibm.wsdl.xml.WSDLReaderImpl) WSDLFactory.newInstance().newWSDLReader());

reader.setFeature("javax.wsdl.importDocuments", true);

reader.setFeature("javax.wsdl.verbose", log.isDebugEnabled());

Definition wsdlDefinition = reader.readWSDL(uri);

ControllerValidationInfo validateInfo = new ValidationInfoImpl(uri, messagegenerator);

URIResolver uriResolver = new URIResolver();

((ValidationInfoImpl) validateInfo).setURIResolver(uriResolver);

/*java.util.Hashtable attributes = new java.util.Hashtable();

((ValidationInfoImpl) validateInfo).setAttributes(attributes);*/

WSDL11ValidationInfoImpl info = new WSDL11ValidationInfoImpl(validateInfo);

info.setElementLocations(new java.util.Hashtable());

WSDL11BasicValidator validator = new WSDL11BasicValidator();

registerExtensionValidators(validator.getClass().getClassLoader());

/*validator.setResourceBundle(rb);*/

IValidationMessage[] messages;

ExtendedWSDL11ValidatorController wsdl11ValidatorController =

new ExtendedWSDL11ValidatorController();

WSDLDocument[] wsdlDocs = wsdl11ValidatorController.readWSDLDocument(doc,

validateInfo.getFileURI(),

messagegenerator,

info);

WSDLDocument document = wsdlDocs[0];

List schema = document.getSchemas();

Iterator xsdIter = schema.iterator();

while (xsdIter.hasNext()) {

info.addSchema((XSModel) xsdIter.next());

}

// Set the element locations table.

info.setElementLocations(document.getElementLocations());

validator.validate(wsdlDefinition, new ArrayList(), info);

messages = validateInfo.getValidationMessages();

WSDLValidationInfo wsdlValidationInfo = new WSDLValidationInfo();

if (messages.length > 0) {

wsdlValidationInfo.setStatus(INVALID);

} else {

wsdlValidationInfo.setStatus(VALID);

}

for (IValidationMessage message : messages) {

String messageString =

"[" + message.getLine() + "][" + message.getColumn() + "]"

+ message.getMessage();

wsdlValidationInfo.addValidationMessage(messageString);

}

return wsdlValidationInfo;

} finally {

if (inputStream != null) {

inputStream.close();

}

}

}

開發者ID:wso2,項目名稱:carbon-registry,代碼行數:75,

示例20: validaWSDLFromURI

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private WSDLValidationInfo validaWSDLFromURI(InputStream stream) throws Exception {

InputStream inputStream = null;

URL url;

try {

String sanitizedXMLString = sanitizeXMLFileData(stream);

Document doc = secureParseXML(sanitizedXMLString);

url = loadXMLToFile(doc);

inputStream = url.openStream();

ResourceBundle rb = ResourceBundle.getBundle("validatewsdl");

MessageGenerator messagegenerator = new MessageGenerator(rb);

WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();

reader.setFeature("javax.wsdl.importDocuments", true);

Definition wsdlDefinition = reader.readWSDL(url.toString());

ControllerValidationInfo validateInfo = new ValidationInfoImpl(url.toString(),

messagegenerator);

URIResolver uriResolver = new URIResolver();

((ValidationInfoImpl) validateInfo).setURIResolver(uriResolver);

/*java.util.Hashtable attributes = new java.util.Hashtable();

((ValidationInfoImpl) validateInfo).setAttributes(attributes);*/

WSDL11ValidationInfoImpl info = new WSDL11ValidationInfoImpl(validateInfo);

info.setElementLocations(new java.util.Hashtable());

WSDL11BasicValidator validator = new WSDL11BasicValidator();

// registerExtensionValidators(validator.getClass().getClassLoader());

/*validator.setResourceBundle(rb);*/

IValidationMessage[] messages;

ExtendedWSDL11ValidatorController wsdl11ValidatorController =

new ExtendedWSDL11ValidatorController();

WSDLDocument[] wsdlDocs = wsdl11ValidatorController.readWSDLDocument(doc,

validateInfo.getFileURI(),

messagegenerator,

info);

WSDLDocument document = wsdlDocs[0];

List schema = document.getSchemas();

for (Object aSchema : schema) {

info.addSchema((XSModel) aSchema);

}

// Set the element locations table.

info.setElementLocations(document.getElementLocations());

validator.validate(wsdlDefinition, new ArrayList(), info);

messages = validateInfo.getValidationMessages();

WSDLValidationInfo wsdlValidationInfo = new WSDLValidationInfo();

if (messages.length > 0) {

wsdlValidationInfo.setStatus(WSDL_INVALID);

} else {

wsdlValidationInfo.setStatus(WSDL_VALID);

}

for (IValidationMessage message : messages) {

String messageString =

"[" + message.getLine() + "][" + message.getColumn() + "]"

+ message.getMessage();

wsdlValidationInfo.addValidationMessage(messageString);

}

return wsdlValidationInfo;

} finally {

if (inputStream != null) {

inputStream.close();

}

}

}

開發者ID:wso2,項目名稱:carbon-commons,代碼行數:66,

示例21: wsdlReader

​點讚 2

import javax.wsdl.xml.WSDLReader; //導入方法依賴的package包/類

private WSDLReader wsdlReader() {

WSDLReader reader = factory.newWSDLReader();

reader.setFeature("javax.wsdl.verbose", true); // true by default

reader.setFeature("javax.wsdl.importDocuments", true); // true by default

return reader;

}

開發者ID:tadayosi,項目名稱:samples-jbossws,代碼行數:7,

注:本文中的javax.wsdl.xml.WSDLReader.setFeature方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值