本文整理汇总了Java中javax.wsdl.xml.WSDLLocator类的典型用法代码示例。如果您正苦于以下问题:Java WSDLLocator类的具体用法?Java WSDLLocator怎么用?Java WSDLLocator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WSDLLocator类属于javax.wsdl.xml包,在下文中一共展示了WSDLLocator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateVersion
import javax.wsdl.xml.WSDLLocator; //导入依赖的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);
}
}
示例2: WSPortConnector
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Creates an instance of port connector.
*
* @param remoteWsdlUrl
* The URL at which the WSDL can be accessed.
* @param userName
* The userName to be used for authentication. <code>null</code>
* if no authentication is required.
* @param password
* The password for the user. <code>null</code> if not required.
* @param host
* optional - if specified, this host will be used instead the
* one from the wsdl
*
* @throws IOException
* @throws WSDLException
*/
public WSPortConnector(String remoteWsdlUrl, String userName,
String password, String host) throws IOException, WSDLException {
this.userName = userName;
this.password = password;
URL url = new URL(remoteWsdlUrl);
if (requiresUserAuthentication(userName, password)) {
url = BasicAuthLoader.load(url, userName, password);
}
WSDLLocator locator = new BasicAuthWSDLLocator(remoteWsdlUrl, userName,
password);
try {
details = getServiceDetails(locator, host);
} finally {
locator.close();
}
}
示例3: Wsdl
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Loads and parses the specified WSDL file.
*
* @param wsdlLocator A javax.wsdl.WSDLLocator instance.
* @param serviceQName Name of the service in the WSDL.
* @param portName The service port name.
*/
public Wsdl(WSDLLocator wsdlLocator, QName serviceQName, String portName) {
// load and parse the WSDL
try {
_wsdlDefinition = parse(wsdlLocator);
}
catch (WSDLException e) {
throw new RuntimeException("Could not load WSDL file: " + e.getMessage(), e);
}
_service = _wsdlDefinition.getService(serviceQName);
if (_service == null) {
throw new IllegalArgumentException("Service: " + serviceQName + " is not defined in the WSDL file.");
}
_port = _service.getPort(portName);
if (_port == null) {
throw new IllegalArgumentException("Port: " + portName
+ " is not defined in the service: " + serviceQName);
}
_wsdlTypes = new WsdlTypes(_wsdlDefinition);
_operationCache = new HashMap<String, WsdlOperation>();
}
示例4: readWSDL
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
public Definition readWSDL(String fileName) throws WSDLException {
Definition wsdlDefinition = null;
WSDLFactory factory = WSDLFactoryImpl.newInstance();
WSDLReader reader = factory.newWSDLReader();
try {
File f = new File(fileName);
URL url = null;
if (f.exists()) {
log.info(fileName + " as a local file doesn't exist.");
url = f.toURI().toURL();
} else {
url = ClassUtil.getResource(fileName, this.getClass());
}
if (url==null){
log.info(fileName + " as a class path resource doesn't exist.");
throw new WSDLException("null input", fileName);
}
URI uri = url.toURI();
WSDLLocator locator = new WSDLLocatorImpl(uri);
wsdlDefinition = reader.readWSDL(locator);
} catch (URISyntaxException e) {
log.error(e.getMessage(), e);
} catch (MalformedURLException ex) {
log.error(ex.getMessage(), ex);
}
return wsdlDefinition;
}
示例5: parse
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Load and parse the WSDL file using the wsdlLocator.
*
* @param wsdlLocator A WSDLLocator instance.
* @param username to use for authentication
* @param password to use for authentication
* @return wsdl Definition.
* @throws WSDLException on error.
*/
private Definition parse(WSDLLocator wsdlLocator, String username, String password)
throws WSDLException, KettleException, AuthenticationException {
WSDLReader wsdlReader = getReader();
try {
return wsdlReader.readWSDL(wsdlLocator);
}
catch (WSDLException we) {
readWsdl(wsdlReader, wsdlURI.toString(), username, password);
return null;
}
}
示例6: getServiceDetails
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Reads the WSDL and determines the target namespace.
*
* @param locator
* The URL of the WSDL.
* @param host
* optional the host to be used when the one from the wsdl must
* not be used
* @return The service's target namespace.
* @throws WSDLException
* Thrown in case the WSDL could not be evaluated.
*/
private WSPortDescription getServiceDetails(WSDLLocator locator, String host)
throws WSDLException {
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
Definition serviceDefinition = wsdlReader.readWSDL(locator);
String tns = serviceDefinition.getTargetNamespace();
// read the port name
String endpointURL = null;
final Map<?, ?> services = serviceDefinition.getServices();
if (services != null) {
for (Object serviceValue : services.values()) {
javax.wsdl.Service service = (javax.wsdl.Service) serviceValue;
Map<?, ?> ports = service.getPorts();
if (ports != null) {
for (Object portValue : ports.values()) {
Port port = (Port) portValue;
List<?> extensibilityElements = port
.getExtensibilityElements();
for (Object ex : extensibilityElements) {
ExtensibilityElement ext = (ExtensibilityElement) ex;
if (ext instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) ext;
endpointURL = address.getLocationURI();
if (host != null) {
int idx = endpointURL.indexOf("//") + 2;
String tmp = endpointURL.substring(0, idx)
+ host
+ endpointURL.substring(endpointURL
.indexOf(':', idx));
endpointURL = tmp;
}
}
}
}
}
}
}
WSPortDescription result = new WSPortDescription();
result.setTargetNamespace(tns);
result.setEndpointURL(endpointURL);
Element versionElement = serviceDefinition.getDocumentationElement();
if (versionElement != null) {
result.setVersion(versionElement.getTextContent());
}
return result;
}
示例7: getWsdl
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
public WSDLLocator getWsdl(String name) {
return new WSDLLocatorImpl(name);
}
示例8: parse
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Load and parse the WSDL file using the wsdlLocator.
*
* @param wsdlLocator
* A WSDLLocator instance.
* @param username
* to use for authentication
* @param password
* to use for authentication
* @return wsdl Definition.
* @throws WSDLException
* on error.
*/
private Definition parse( WSDLLocator wsdlLocator, String username, String password ) throws WSDLException,
KettleException, AuthenticationException {
WSDLReader wsdlReader = getReader();
try {
return wsdlReader.readWSDL( wsdlLocator );
} catch ( WSDLException we ) {
readWsdl( wsdlReader, wsdlURI.toString(), username, password );
return null;
}
}
示例9: setCustomWSLD4JResolver
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* @deprecated
* @see setCustomWSDLResolver
*/
public void setCustomWSLD4JResolver(WSDLLocator customResolver) {
setCustomWSDLResolver(customResolver);
}
示例10: setCustomWSDLResolver
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* sets a custom WSDL locator
*
* @param customResolver
*/
public void setCustomWSDLResolver(WSDLLocator customResolver) {
this.customWSDLResolver = customResolver;
setDocumentBaseUri(this.customWSDLResolver.getBaseURI());
}
示例11: parse
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Load and parse the WSDL file using the wsdlLocator.
*
* @param wsdlLocator A WSDLLocator instance.
* @return wsdl Definition.
* @throws WSDLException on error.
*/
private Definition parse(WSDLLocator wsdlLocator) throws WSDLException {
WSDLReader wsdlReader = getReader();
return wsdlReader.readWSDL(wsdlLocator);
}
示例12: Wsdl
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Loads and parses the specified WSDL file.
*
* @param wsdlLocator A javax.wsdl.WSDLLocator instance.
* @param serviceQName Name of the service in the WSDL.
* @param portName The service port name.
*/
public Wsdl(WSDLLocator wsdlLocator, QName serviceQName, String portName)
throws AuthenticationException {
this(wsdlLocator, serviceQName, portName, null, null);
}
示例13: Wsdl
import javax.wsdl.xml.WSDLLocator; //导入依赖的package包/类
/**
* Loads and parses the specified WSDL file.
*
* @param wsdlLocator
* A javax.wsdl.WSDLLocator instance.
* @param serviceQName
* Name of the service in the WSDL.
* @param portName
* The service port name.
*/
public Wsdl( WSDLLocator wsdlLocator, QName serviceQName, String portName ) throws AuthenticationException {
this( wsdlLocator, serviceQName, portName, null, null );
}