javax.wsdl.Port类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中javax.wsdl.Port类的一些代码示例,展示了Port类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Port类的具体详情如下:
包路径:javax.wsdl.Port
类名称:Port

Port介绍

[英]This interface represents a port, an endpoint for the functionality described by a particular port type.
[中]这个接口代表一个端口,一个特定端口类型描述的功能的端点。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get a list of all operations defined in this WSDL.
 *
 * @return List of WsdlOperations.
 */
@SuppressWarnings( "unchecked" )
public List<WsdlOperation> getOperations() throws KettleStepException {
 List<WsdlOperation> opList = new ArrayList<WsdlOperation>();
 PortType pt = _port.getBinding().getPortType();
 List<Operation> operations = pt.getOperations();
 for ( Iterator<Operation> itr = operations.iterator(); itr.hasNext(); ) {
  WsdlOperation operation = getOperation( itr.next().getName() );
  if ( operation != null ) {
   opList.add( operation );
  }
 }
 return opList;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Get the name of the current port.
 *
 * @return Name of the current port.
 */
public String getPortName() {
 return _port.getName();
}

代码示例来源:origin: apache/cxf

if (existingService != null) {
      String existingServiceNS =
        ((Port) existingService.getPorts().values().iterator().next())
        .getBinding().getPortType().getQName().getNamespaceURI();
      existingService.setQName(new QName(def.getTargetNamespace(),
                        serviceNames.get(existingServiceNS)));
      serviceMap.put(existingServiceNS, existingService);
Port port = def.createPort();
port.setName(portTypeName.getLocalPart() + "CORBAPort");
AddressType address =
  (AddressType) def.getExtensionRegistry().createExtension(Port.class,
port.addExtensibilityElement((ExtensibilityElement)address);
service.addPort(port);
port.setBinding(bindings[i]);

代码示例来源:origin: org.jboss.fuse.wsdl2rest/wsdl2rest-impl

@SuppressWarnings("unchecked")
private void processServices(Definition def) {
  Map<QName, Service> services = def.getServices();
  log.info("Services: ");
  for (Service svc : services.values()) {
    String svcName = svc.getQName().getLocalPart();
    log.info("\t{}", svcName);
    Map<QName, Port> ports = svc.getPorts();
    for (Port port : ports.values()) {
      log.info("\tPort: {}", port.getName());
      processBinding(def, port.getBinding());
    }
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

protected Dispatch<SOAPMessage> createDispatchFromURI(String uri) {
  QName serviceName = wsBinding.getService().getQName();
  QName portName = new QName(serviceName.getNamespaceURI(), wsBinding.getPort().getName());
  Service service = Service.create(serviceName);
  service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, uri);
  
  return service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
}

代码示例来源:origin: apache/cxf

private Map<QName, XNode> getBindings(Service service) {
  Map<QName, XNode> bindings = new HashMap<>();
  if (service.getPorts().values().isEmpty()) {
    throw new ToolException("Service " + service.getQName() + " does not contain any usable ports");
  }
  Collection<Port> ports = CastUtils.cast(service.getPorts().values());
  for (Port port : ports) {
    Binding binding = port.getBinding();
    bindings.put(binding.getQName(), getXNode(service, port));
    if (WSDLConstants.NS_WSDL11.equals(binding.getQName().getNamespaceURI())) {
      throw new ToolException("Binding "
                  + binding.getQName().getLocalPart()
                  + " namespace set improperly.");
    }
  }
  return bindings;
}

代码示例来源:origin: apache/cxf

private void doAppendService() throws ToolException {
  if (service == null) {
    service = wsdlDefinition.createService();
    service
      .setQName(new QName(WSDLConstants.WSDL_PREFIX, (String)env.get(ToolConstants.CFG_SERVICE)));
  }
  if (port == null) {
    port = wsdlDefinition.createPort();
    port.setName((String)env.get(ToolConstants.CFG_PORT));
    port.setBinding(binding);
  }
  setAddrElement();
  service.addPort(port);
  wsdlDefinition.addService(service);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

PortType portType) throws AxisFault {
Map wsdl4jPorts = wsdl4jService.getPorts();
QName bindingName = binding.getQName();
  port = (Port) iterator.next();
  if ((this.portName == null) || (this.portName.equals(port.getName()))) {
        port.getBinding().getQName(), COMPONENT_BINDING, new HashSet());
    currentBinding = currentBindingWSDL.getBinding(port.getBinding().getQName());
    if (currentBinding.getPortType().getQName().equals(binding.getPortType().getQName())) {
      axisEndpoint = new AxisEndpoint();
      axisEndpoint.setName(port.getName());
          bindingName.equals(port.getBinding().getQName())) {
        populateEndpoint(axisEndpoint, port, currentBinding,
            bindingWSDL, portType, true);
        axisService.setEndpointName(axisEndpoint.getName());
        axisService.setBindingName(axisEndpoint.getBinding().getName().getLocalPart());
      } else {
        populateEndpoint(axisEndpoint, port, currentBinding,
      axisService.addEndpoint(port.getName(), axisEndpoint);

代码示例来源:origin: apache/cxf

public static javax.wsdl.Service doAppendService(Definition wsdlDefinition,
                         String existPortName, ExtensionRegistry
                         extReg, Binding binding) throws Exception {
  javax.wsdl.Service wsdlService = wsdlDefinition.createService();
  wsdlService.setQName(new QName(wsdlDefinition.getTargetNamespace(), existPortName + serviceName));
  Port port = wsdlDefinition.createPort();
  port.setName(existPortName + portName);
  port.setBinding(binding);
  SOAPAddress address = PartialWSDLProcessor.setAddrElement(wsdlDefinition, port, extReg);
  port.addExtensibilityElement(address);
  wsdlService.addPort(port);
  return wsdlService;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

try {
  Definition def = wsdlManager.getDefinition(wsdlDocumentLocation);
  interfaceName = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding()
    .getPortType().getQName();
} catch (Exception e) {
        ? serviceName.getNamespaceURI() + " " + wsdlDocumentLocation
        : wsdlDocumentLocation;
    writer.writeNamespace(JAXWSAConstants.WSDLI_PFX,
                 JAXWSAConstants.WSAM_INTERFACE_NAME,
                 JAXWSAConstants.NS_WSAM);
    String portTypePrefix = interfaceName.getPrefix();
    if (portTypePrefix == null || portTypePrefix.isEmpty()) {
      portTypePrefix = "ns1";

代码示例来源:origin: org.springframework.ws/org.springframework.ws

/**
 * Called after the {@link Port} has been created, but before any sub-elements are added. Subclasses can implement
 * this method to define the port name, or add extensions to it.
 * <p/>
 * Default implementation sets the port name to the binding name.
 *
 * @param definition the WSDL4J <code>Definition</code>
 * @param port       the WSDL4J <code>Port</code>
 * @throws WSDLException in case of errors
 */
protected void populatePort(Definition definition, Port port) throws WSDLException {
  String portName = port.getBinding().getQName().getLocalPart();
  port.setName(portName);
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

public String getPortBinding(QName serviceQname, QName portQname) {
  Port port = getPort(serviceQname, portQname);
  if (port == null) {
    return null;
  }
  Binding binding = port.getBinding();
  return binding.getQName().getLocalPart();
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

private void initializePorts() {
  try {
    Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlURL);
    javax.wsdl.Service serv = def.getService(serviceName);
    if (serv == null) {
      throw new WebServiceException("Could not find service named " + serviceName
    Map<String, Port> wsdlports = CastUtils.cast(serv.getPorts());
    for (Port port : wsdlports.values()) {
      QName name = new QName(serviceName.getNamespaceURI(), port.getName());
        = CastUtils.cast(port.getBinding().getExtensibilityElements());
      if (!extensions.isEmpty()) {
        ExtensibilityElement e = extensions.get(0);
      extensions = CastUtils.cast(port.getExtensibilityElements());
      if (!extensions.isEmpty()) {
        ExtensibilityElement e = extensions.get(0);

代码示例来源:origin: org.apache.axis/axis

/**
 * constructor
 * 
 * @param port the WSDL port element
 */
public PortEntry(Port port) {
  super(new QName(port.getName()));
  this.port = port;
}

代码示例来源:origin: org.apache.axis/axis

QName serviceElementQName = new QName(implNS, getServiceElementName());
Service service = def.getService(serviceElementQName);
  service = def.createService();
  service.setQName(serviceElementQName);
  def.addService(service);
  service.setDocumentationElement(
      createDocumentationElement(description));
} else if (serviceDesc.getDocumentation() != null) {
  service.setDocumentationElement(
      createDocumentationElement(
          serviceDesc.getDocumentation()));
Port port = def.createPort();
port.setBinding(binding);
port.setName(getServicePortName());
port.addExtensibilityElement(addr);
service.addPort(port);

代码示例来源:origin: org.ow2.jonas/jonas-deployment

/**
 * Init the wsdlPorts list.
 */
private void fillWsdlPorts() {
  Map svcs = def.getServices();
  Iterator svcsIt = svcs.values().iterator();
  while (svcsIt.hasNext()) {
    Service svc = (Service) svcsIt.next();
    if (svc != null) {
      for (Iterator j = svc.getPorts().values().iterator(); j.hasNext();) {
        Port p = (Port) j.next();
        wsdlPorts.add(new QName(def.getTargetNamespace(), p.getName()));
      }
    }
  }
}

代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro

String targetNamespace = wsdl.getTargetNamespace();
String localName = logicalBinding.getParent().getUri().getFragment();
QName serviceName = new QName(targetNamespace, localName);
String localPortName = localName + "Port";
  copy.addBinding(binding);
  QName portName = new QName(targetNamespace, localPortName);
  Port port = copy.createPort();
  port.setName(localPortName);
  port.setBinding(binding);
  SOAPAddress soapAddress = (SOAPAddress) copy.getExtensionRegistry().createExtension(Port.class, SOAP_ADDRESS);
  soapAddress.setLocationURI(endpointAddress);
  port.addExtensibilityElement(soapAddress);
  Service service = copy.createService();
  service.setQName(serviceName);
  service.addPort(port);
  copy.addService(service);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-wsdlgen

protected void configurePort(Port port, Binding binding) throws WSDLException {
  if ( wsBindingName != null ) {
    port.setName(wsBindingName + getSOAPVersionString() + PORT_SUFFIX);
  } else if (binding.getPortType() != null && binding.getPortType().getQName() != null) {
    port.setName(binding.getPortType().getQName().getLocalPart() + PORT_SUFFIX);
  }
}

代码示例来源:origin: org.apache.servicemix/servicemix-common

Binding binding = def.createBinding();
binding.setQName(new QName(def.getTargetNamespace(), bindingName));
binding.setPortType(portType);
binding.setUndefined(false);
List<?> operations = portType.getOperations();
for (Iterator<?> iter = operations.iterator(); iter.hasNext();) {
  Operation operation = (Operation) iter.next();
Service service = def.createService();
service.setQName(new QName(def.getTargetNamespace(), serviceName));
Port port = def.createPort();
port.setName(portName);
port.setBinding(binding);
if (soap11) {
  SOAPAddress address = new SOAPAddressImpl();
  address.setLocationURI(locationUri);
  port.addExtensibilityElement(address);
} else {
  SOAP12Address address = new SOAP12AddressImpl();
  address.setLocationURI(locationUri);
  port.addExtensibilityElement(address);
service.addPort(port);
def.addService(service);

代码示例来源:origin: org.codehaus.xfire/xfire-core

public Port createPort(Endpoint endpoint, WSDLBuilder builder, javax.wsdl.Binding wbinding)
{
  SOAPAddressImpl add = new SOAPAddressImpl();
  add.setLocationURI(endpoint.getUrl());
  
  Port port = builder.getDefinition().createPort();
  port.setBinding( wbinding );
  port.setName( endpoint.getName().getLocalPart() );
  port.addExtensibilityElement( add );
    return port;
}

相关文章