本文整理汇总了Java中javax.wsdl.Port.getExtensibilityElements方法的典型用法代码示例。如果您正苦于以下问题:Java Port.getExtensibilityElements方法的具体用法?Java Port.getExtensibilityElements怎么用?Java Port.getExtensibilityElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.wsdl.Port
的用法示例。
在下文中一共展示了Port.getExtensibilityElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectPort
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Method selectPort
*
* @param ports
* @param portName
*
* @return
*
* @throws Exception
*/
public Port selectPort(Map ports, String portName) throws Exception {
Iterator valueIterator = ports.keySet().iterator();
while (valueIterator.hasNext()) {
String name = (String) valueIterator.next();
if ((portName == null) || (portName.length() == 0)) {
Port port = (Port) ports.get(name);
List list = port.getExtensibilityElements();
for (int i = 0; (list != null) && (i < list.size()); i++) {
Object obj = list.get(i);
if (obj instanceof SOAPAddress) {
return port;
}
}
} else if ((name != null) && name.equals(portName)) {
return (Port) ports.get(name);
}
}
return null;
}
示例2: importService
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Imports the service from the WSDL service definition
*/
protected WSService importService(Service service) {
String name = service.getQName().getLocalPart();
Port port = (Port) service.getPorts().values().iterator().next();
String location = "";
List extensionElements = port.getExtensibilityElements();
for (Object extension : extensionElements) {
if (extension instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extension;
location = address.getLocationURI();
}
}
WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
return wsService;
}
示例3: importService
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Imports the service from the WSDL service definition
*/
private WSService importService(Service service) {
String name = service.getQName().getLocalPart();
Port port = (Port) service.getPorts().values().iterator().next();
String location = "";
List extensionElements = port.getExtensibilityElements();
for (Object extension : extensionElements) {
if (extension instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extension;
location = address.getLocationURI();
}
}
WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
return wsService;
}
示例4: getSoapPort
import javax.wsdl.Port; //导入方法依赖的package包/类
public static Port getSoapPort(javax.wsdl.Service service) throws RPCException {
String name = null;
Port port = null;
List list = null;
Map ports = service.getPorts();
Iterator it;
Iterator<Port> itr = ports.values().iterator();
Object v;
while(itr.hasNext()) {
port = itr.next();
list=port.getExtensibilityElements();
if(list != null) {
it = list.iterator();
while(it.hasNext()) {
v=it.next();
if(v instanceof SOAPAddress) {
return port;
}
}
}
}
throw new RPCException("Can't locate port entry for service " + service.getQName().toString() + " WSDL");
}
示例5: filterWSDL
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Filters the WSDL document.
*
* @param definition location pointing to a WSDL XML definition.
* @param propertyResolver the Property Resolver
*/
public static void filterWSDL(Definition definition, PropertyResolver propertyResolver) {
for (Object serviceObject : definition.getServices().values()) {
Service service = (Service) serviceObject;
for (Object portObject : service.getPorts().values()) {
Port port = (Port) portObject;
for (Object extObject : port.getExtensibilityElements()) {
if (extObject instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) extObject;
String toReplace = Strings.replaceProperties(address.getLocationURI(), propertyResolver);
if (!toReplace.isEmpty() && !toReplace.equals(address.getLocationURI())) {
address.setLocationURI(toReplace);
}
}
}
}
}
}
示例6: getBindingId
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Get the SOAP Binding Id for the specified {@link Port}.
*
* @param port The WSDL port.
* @param mtomEnabled MTOM feature boolean
* @return The SOAPBinding Id found on the port.
*/
public static String getBindingId(Port port, Boolean mtomEnabled) {
String bindingId = null;
List<ExtensibilityElement> extElements = port.getExtensibilityElements();
for (ExtensibilityElement extElement : extElements) {
if (extElement instanceof SOAP12Address) {
if (mtomEnabled) {
bindingId = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
} else {
bindingId = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
}
break;
} else {
if (mtomEnabled) {
bindingId = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
} else {
bindingId = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
}
break;
}
}
return bindingId;
}
示例7: getEPRfromWSDL
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Get the EPR of this service from the WSDL.
*
* @param wsdlDef WSDL Definition
* @param serviceName service name
* @param portName port name
* @return XML representation of the EPR
*/
public static String getEPRfromWSDL(
final Definition wsdlDef,
final QName serviceName,
final String portName) {
Service serviceDef = wsdlDef.getService(serviceName);
if (serviceDef != null) {
Port portDef = serviceDef.getPort(portName);
if (portDef != null) {
for (Object extElmt : portDef.getExtensibilityElements()) {
if (extElmt instanceof SOAPAddress) {
return ((SOAPAddress) extElmt).getLocationURI();
} else if (extElmt instanceof HTTPAddress) {
return ((HTTPAddress) extElmt).getLocationURI();
} else if (extElmt instanceof SOAP12Address) {
return ((SOAP12Address) extElmt).getLocationURI();
}
}
}
}
return null;
}
示例8: getBindingURL
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Obtains the accessUrl from the WSDL
*
* @param port
* @return a string url
* @throws MalformedURLException
*/
private String getBindingURL(Port port) throws MalformedURLException {
String bindingUrl = null;
for (Object element : port.getExtensibilityElements()) {
if (element instanceof SOAPAddress) {
SOAPAddress address = (SOAPAddress) element;
URL locationURI = new URL(address.getLocationURI());
if (locationURI != null) {
bindingUrl = urlLocalizer.rewrite(locationURI);
break;
}
}
}
return bindingUrl;
}
示例9: getWSDLSOAPAddress
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Return the SOAP Address from the WSDL for this port.
*
* @return The SOAP Address from the WSDL for this port or null.
*/
public String getWSDLSOAPAddress() {
if (wsdlSOAPAddress == null) {
Port wsdlPort = getWSDLPort();
if (wsdlPort != null) {
// The port is in the WSDL, so see if it has a SOAP address extensibility element specified.
List extElementList = wsdlPort.getExtensibilityElements();
for (Object listElement : extElementList) {
ExtensibilityElement extElement = (ExtensibilityElement)listElement;
if (isSOAPAddressElement(extElement)) {
String soapAddress = getSOAPAddressFromElement(extElement);
if (!DescriptionUtils.isEmpty(soapAddress)) {
wsdlSOAPAddress = soapAddress;
}
}
}
}
}
return wsdlSOAPAddress;
}
示例10: getSOAPLocation
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* @param port analyzed port
* @return Returns the endpoint URL of the given Port
*/
private String getSOAPLocation(Port port) {
String endpoint = null;
@SuppressWarnings("unchecked") // Can't change the API
List<ExtensibilityElement> extensions = port.getExtensibilityElements();
for (Iterator<ExtensibilityElement> i = extensions.iterator();
i.hasNext();) {
ExtensibilityElement ext = i.next();
if (ext instanceof SOAPAddress) {
SOAPAddress addr = (SOAPAddress) ext;
endpoint = addr.getLocationURI();
}
}
return endpoint;
}
示例11: getSOAPLocation
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* @param port analyzed port
* @return Returns the endpoint URL of the given Port
*/
private String getSOAPLocation(Port port) {
String endpoint = null;
List extensions = port.getExtensibilityElements();
for (Iterator i = extensions.iterator(); i.hasNext();) {
ExtensibilityElement ext = (ExtensibilityElement) i.next();
if (ext instanceof SOAPAddress) {
SOAPAddress addr = (SOAPAddress) ext;
endpoint = addr.getLocationURI();
}
}
return endpoint;
}
示例12: getEndpointAddress
import javax.wsdl.Port; //导入方法依赖的package包/类
/**
* Get the SOAP Binding Id for the specified {@link Port}.
*
* @param port The WSDL port.
* @return The endpoint address.
*/
public static String getEndpointAddress(Port port) {
String address = null;
List<ExtensibilityElement> extElements = port.getExtensibilityElements();
for (ExtensibilityElement extElement : extElements) {
if (extElement instanceof SOAPAddress) {
address = ((SOAPAddress)extElement).getLocationURI();
break;
} else if (extElement instanceof SOAP12Address) {
address = ((SOAP12Address)extElement).getLocationURI();
break;
}
}
return address;
}
示例13: getPortAddress
import javax.wsdl.Port; //导入方法依赖的package包/类
public static String getPortAddress(final Port port) {
final Collection<?> extensibilityElements = port.getExtensibilityElements();
SOAPAddress soapAddress = findExtensibilityElement(extensibilityElements, SOAPAddress.class);
if (null != soapAddress) {
return soapAddress.getLocationURI();
}
SOAP12Address soap12Address = findExtensibilityElement(extensibilityElements, SOAP12Address.class);
if (null != soap12Address) {
return soap12Address.getLocationURI();
}
return null;
}
示例14: getWSDLPortsUsingSOAPAddress
import javax.wsdl.Port; //导入方法依赖的package包/类
public List<Port> getWSDLPortsUsingSOAPAddress(List<Port> wsdlPorts) {
ArrayList<Port> portsUsingAddress = new ArrayList<Port>();
if (wsdlPorts != null && !wsdlPorts.isEmpty()) {
for (Port checkPort : wsdlPorts) {
List extensibilityElementList = checkPort.getExtensibilityElements();
for (Object checkElement : extensibilityElementList) {
if (EndpointDescriptionImpl
.isSOAPAddressElement((ExtensibilityElement)checkElement)) {
portsUsingAddress.add(checkPort);
}
}
}
}
return portsUsingAddress;
}
示例15: getServiceDetails
import javax.wsdl.Port; //导入方法依赖的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;
}