本文整理匯總了Java中javax.xml.ws.Service.getPort方法的典型用法代碼示例。如果您正苦於以下問題:Java Service.getPort方法的具體用法?Java Service.getPort怎麽用?Java Service.getPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.ws.Service
的用法示例。
在下文中一共展示了Service.getPort方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPort
import javax.xml.ws.Service; //導入方法依賴的package包/類
/**
* Determines the reference to a web service provided by a technical
* service.
*
* @param <T>
* The type of service obtained.
* @param localWsdlUrl
* The URL to a local service-related WSDL. The WSDL should be
* provided as file in a bundled .jar file.
* @param serviceClass
* The service class implemented by the WSDL.
* @return The web service reference.
* @throws ParserConfigurationException
* @throws WebServiceException
* Has to be caught by a caller, although it's a runtime
* exception
*/
public <T> T getPort(URL localWsdlUrl, Class<T> serviceClass)
throws ParserConfigurationException, WebServiceException {
Service service = getService(localWsdlUrl, serviceClass);
//EndpointReference epr = determineEndpointReference();
T port = service.getPort(serviceClass);
BindingProvider bindingProvider = (BindingProvider) port;
Map<String, Object> clientRequestContext = bindingProvider
.getRequestContext();
clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, details.getEndpointURL());
if (requiresUserAuthentication(userName, password)) {
// BindingProvider bindingProvider = (BindingProvider) port;
// Map<String, Object> clientRequestContext = bindingProvider
// .getRequestContext();
clientRequestContext.put(BindingProvider.USERNAME_PROPERTY,
userName);
clientRequestContext.put(BindingProvider.PASSWORD_PROPERTY,
password);
}
return port;
}
示例2: getPortStub
import javax.xml.ws.Service; //導入方法依賴的package包/類
/**
* Obtain the port stub from the given JAX-WS Service.
* @param service the Service object to obtain the port from
* @param portQName the name of the desired port, if specified
* @return the corresponding port object as returned from
* {@code Service.getPort(...)}
*/
protected Object getPortStub(Service service, QName portQName) {
if (this.portFeatures != null || this.webServiceFeatures != null) {
WebServiceFeature[] portFeaturesToUse = this.portFeatures;
if (portFeaturesToUse == null) {
portFeaturesToUse = new WebServiceFeature[this.webServiceFeatures.length];
for (int i = 0; i < this.webServiceFeatures.length; i++) {
portFeaturesToUse[i] = convertWebServiceFeature(this.webServiceFeatures[i]);
}
}
return (portQName != null ? service.getPort(portQName, getServiceInterface(), portFeaturesToUse) :
service.getPort(getServiceInterface(), portFeaturesToUse));
}
else {
return (portQName != null ? service.getPort(portQName, getServiceInterface()) :
service.getPort(getServiceInterface()));
}
}
示例3: getServicePort
import javax.xml.ws.Service; //導入方法依賴的package包/類
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
throws MalformedURLException {
String targetNamespace = serviceClass.getAnnotation(WebService.class)
.targetNamespace();
QName serviceQName = new QName(targetNamespace,
serviceClass.getSimpleName());
Service service = createWebService(getWsdlUrl(serviceClass, settings),
serviceQName);
// addVersionInformation(service);
return service.getPort(serviceClass);
}
示例4: createProxy
import javax.xml.ws.Service; //導入方法依賴的package包/類
/**
* Helper method for creating a web service proxy. The service version
* information is added into the header of the outbound SOAP message.
*
* @param info
* - the properties for accessing the web service
* @param type
* - web service described with the corresponding type
* @return the web service proxy
* @throws MalformedURLException
*/
private static <T> T createProxy(WsInfo info, final Class<T> type) {
Service service = null;
try {
service = Service.create(new URL(info.getRemoteBssWsUrl()),
new QName(NAMESPACE_URI, type.getSimpleName()));
} catch (MalformedURLException e) {
String text = "Error:Malformed URL";
logger.error(text);
}
service = addVersionInformation(service);
return service.getPort(type);
}
示例5: getServicePort
import javax.xml.ws.Service; //導入方法依賴的package包/類
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
throws MalformedURLException {
String targetNamespace = serviceClass.getAnnotation(WebService.class)
.targetNamespace();
QName serviceQName = new QName(targetNamespace,
serviceClass.getSimpleName());
Service service = createWebService(getWsdlUrl(serviceClass, settings),
serviceQName);
addVersionInformation(service);
return service.getPort(serviceClass);
}
示例6: getServicePort
import javax.xml.ws.Service; //導入方法依賴的package包/類
private <T> T getServicePort(Class<T> serviceClass)
throws ParserConfigurationException {
String targetNamespace = serviceClass.getAnnotation(WebService.class)
.targetNamespace();
QName serviceQName = new QName(targetNamespace,
serviceClass.getSimpleName());
Service service = createWebService(localWSDLUrl, serviceQName);
service = addVersionInformation(service);
return service.getPort(
determineEndpointReference(serviceClass.getSimpleName()),
serviceClass);
}
示例7: getBSSWebService
import javax.xml.ws.Service; //導入方法依賴的package包/類
/**
* Creates a OSCM Web service with the given parameters.
*
* @param serviceClass
* the class of the Web service to be created
* @param authentication
* a <code>PasswordAuthentication</code> object specifying the
* credentials to be used for authentication
* @return the service class
* @throws ConfigurationException
* if the configuration of the platform is incorrect
* @throws MalformedURLException
* if the base URL of the OSCM configuration is malformed
*/
public static <T> T getBSSWebService(Class<T> serviceClass,
PasswordAuthentication authentication)
throws ConfigurationException, MalformedURLException {
String targetNamespace = serviceClass.getAnnotation(WebService.class)
.targetNamespace();
QName serviceQName = new QName(targetNamespace,
serviceClass.getSimpleName());
String wsdlUrl = APPlatformServiceFactory.getInstance()
.getBSSWebServiceWSDLUrl();
wsdlUrl = wsdlUrl.replace("{SERVICE}", serviceClass.getSimpleName());
String serviceUrl = APPlatformServiceFactory.getInstance()
.getBSSWebServiceUrl();
serviceUrl=serviceUrl.replace("{SERVICE}", serviceClass.getSimpleName());
Service service = Service.create(new URL(wsdlUrl), serviceQName);
boolean isSsoMode = wsdlUrl != null
&& wsdlUrl.toLowerCase().endsWith("/sts?wsdl");
String portSuffix = isSsoMode ? "PortSTS" : "PortBASIC";
T client = service.getPort(
new QName(targetNamespace, serviceClass.getSimpleName()
+ portSuffix), serviceClass);
String usernameConstant = isSsoMode ? "username"
: BindingProvider.USERNAME_PROPERTY;
String passwordConstant = isSsoMode ? "password"
: BindingProvider.PASSWORD_PROPERTY;
Map<String, Object> clientRequestContext = ((BindingProvider) client)
.getRequestContext();
clientRequestContext
.put(usernameConstant, authentication.getUserName());
clientRequestContext
.put(passwordConstant, authentication.getPassword());
clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceUrl );
return client;
}
示例8: getPort
import javax.xml.ws.Service; //導入方法依賴的package包/類
/**
* Creates a proxy that can be used to talk to this EPR.
*
* <p>
* All the normal WS-Addressing processing happens automatically,
* such as setting the endpoint address to {@link #getAddress() the address},
* and sending the reference parameters associated with this EPR as
* headers, etc.
*/
public @NotNull <T> T getPort(@NotNull Service jaxwsService,
@NotNull Class<T> serviceEndpointInterface,
WebServiceFeature... features) {
// TODO: implement it in a better way
return jaxwsService.getPort(toSpec(),serviceEndpointInterface,features);
}