javax.wsdl.Port.addExtensibilityElement()方法的使用及代码示例

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

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

Port.addExtensibilityElement介绍

暂无

代码示例

代码示例来源:origin: wsdl4j/wsdl4j

port.addExtensibilityElement(parseExtensibilityElement(Port.class,
                            tempEl,
                            def));

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

/**
 * Called after the {@link javax.wsdl.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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link javax.wsdl.extensions.soap.SOAPAddress}, and calls {@link #populateSoapAddress(SOAP12Address)}.
 *
 * @param port the WSDL4J <code>Port</code>
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAP12Binding) {
      // this is a SOAP 1.2 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAP12Address soapAddress = (SOAP12Address) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

代码示例来源:origin: spring-projects/spring-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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link SOAPAddress}, and calls {@link #populateSoapAddress(SOAPAddress)}.
 *
 * @param port the WSDL4J {@code Port}
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAPBinding) {
      // this is a SOAP 1.1 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAPAddress soapAddress = (SOAPAddress) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

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

/**
 * Called after the {@link javax.wsdl.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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link javax.wsdl.extensions.soap.SOAPAddress}, and calls {@link #populateSoapAddress(SOAP12Address)}.
 *
 * @param port the WSDL4J {@code Port}
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAP12Binding) {
      // this is a SOAP 1.2 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAP12Address soapAddress = (SOAP12Address) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

代码示例来源: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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link SOAPAddress}, and calls {@link #populateSoapAddress(SOAPAddress)}.
 *
 * @param port the WSDL4J <code>Port</code>
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAPBinding) {
      // this is a SOAP 1.1 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAPAddress soapAddress = (SOAPAddress) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

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

/**
 * 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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link SOAPAddress}, and calls {@link #populateSoapAddress(SOAPAddress)}.
 *
 * @param port the WSDL4J {@code Port}
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAPBinding) {
      // this is a SOAP 1.1 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAPAddress soapAddress = (SOAPAddress) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

代码示例来源:origin: spring-projects/spring-ws

/**
 * Called after the {@link javax.wsdl.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 calls {@link DefaultConcretePartProvider#populatePort(javax.wsdl.Definition,javax.wsdl.Port)},
 * creates a {@link javax.wsdl.extensions.soap.SOAPAddress}, and calls {@link #populateSoapAddress(SOAP12Address)}.
 *
 * @param port the WSDL4J {@code Port}
 * @throws WSDLException in case of errors
 */
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  for (Iterator<?> iterator = port.getBinding().getExtensibilityElements().iterator(); iterator.hasNext();) {
    if (iterator.next() instanceof SOAP12Binding) {
      // this is a SOAP 1.2 binding, create a SOAP Address for it 
      super.populatePort(definition, port);
      SOAP12Address soapAddress = (SOAP12Address) createSoapExtension(definition, Port.class, "address");
      populateSoapAddress(soapAddress);
      port.addExtensibilityElement(soapAddress);
      return;
    }
  }
}

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

private void setAddrElement() throws ToolException {
  Address address = AddressFactory.getInstance().getAddresser("xml");
  for (Map.Entry<String, String> entry : address.getNamespaces(env).entrySet()) {
    wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
  }
  WSDLExtensibilityPlugin generator = getWSDLPlugin("xml", Port.class);
  try {
    ExtensibilityElement extElement = generator.createExtension(address.buildAddressArguments(env));
    port.addExtensibilityElement(extElement);
  } catch (WSDLException wse) {
    Message msg = new Message("FAIL_TO_CREATE_SOAPADDRESS", LOG);
    throw new ToolException(msg);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-tools-misctools

private void setAddrElement() throws ToolException {
  Address address = AddressFactory.getInstance().getAddresser("xml");
  for (Map.Entry<String, String> entry : address.getNamespaces(env).entrySet()) {
    wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
  }
  WSDLExtensibilityPlugin generator = getWSDLPlugin("xml", Port.class);
  try {
    ExtensibilityElement extElement = generator.createExtension(address.buildAddressArguments(env));
    port.addExtensibilityElement(extElement);
  } catch (WSDLException wse) {
    Message msg = new Message("FAIL_TO_CREATE_SOAPADDRESS", LOG);
    throw new ToolException(msg);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-tools-misctools

private void setAddrElement() throws ToolException {
    String transport = (String)env.get(ToolConstants.CFG_TRANSPORT);
    Address address = AddressFactory.getInstance().getAddresser(transport);

    Map<String, String> ns = address.getNamespaces(env);
    for (Map.Entry<String, String> entry : ns.entrySet()) {
      wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
    }

    WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
    try {
      ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
      port.addExtensibilityElement(extElement);
    } catch (WSDLException wse) {
      Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
      throw new ToolException(msg, wse);
    }
  }
}

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

private void setAddrElement() throws ToolException {
    String transport = (String)env.get(ToolConstants.CFG_TRANSPORT);
    Address address = AddressFactory.getInstance().getAddresser(transport);

    Map<String, String> ns = address.getNamespaces(env);
    for (Map.Entry<String, String> entry : ns.entrySet()) {
      wsdlDefinition.addNamespace(entry.getKey(), entry.getValue());
    }

    WSDLExtensibilityPlugin plugin = getWSDLPlugin(transport, Port.class);
    try {
      ExtensibilityElement extElement = plugin.createExtension(address.buildAddressArguments(env));
      port.addExtensibilityElement(extElement);
    } catch (WSDLException wse) {
      Message msg = new Message("FAIL_TO_CREATE_SOAP_ADDRESS", LOG);
      throw new ToolException(msg, wse);
    }
  }
}

代码示例来源: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;
}

代码示例来源: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-bundle-jaxrs

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-core

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.objectweb.celtix/celtix-tools

public void generate() {
    Service service = definition.createService();
    service.setQName(new QName(WSDLConstants.WSDL_PREFIX, wmodel.getServiceName()));
    Port port = definition.createPort();
    port.setName(wmodel.getPortName());
    Binding binding = definition.createBinding();
    String targetNameSpace = wmodel.getTargetNameSpace();
    binding.setQName(new QName(targetNameSpace, wmodel.getPortTypeName() + "Binding"));
    port.setBinding(binding);
    SOAPAddress soapAddress = null;
    try {
      soapAddress = (SOAPAddress)extensionRegistry
        .createExtension(Port.class, new QName(WSDLConstants.SOAP11_NAMESPACE, "address"));
      soapAddress.setLocationURI(ADDRESS_URI);
    } catch (WSDLException e) {
      throw new ToolException(e.getMessage(), e);
    }
    port.addExtensibilityElement(soapAddress);
    service.addPort(port);
    definition.addService(service);
  }
}

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

public Port createPort(Definition definition, Binding binding, Service service, String uri) {
  try {
    Port port = definition.createPort();
    port.setBinding(binding);
    configurePort(port, binding);
    if (uri != null) {
      ExtensibilityElement portExtension =
        definition.getExtensionRegistry().createExtension(Port.class, soapAddress);
      if (requiresSOAP12) {
        ((SOAP12Address)portExtension).setLocationURI(uri);
      } else {
        ((SOAPAddress)portExtension).setLocationURI(uri);
      }
      port.addExtensibilityElement(portExtension);
    }
    service.addPort(port);
    return port;
  } catch (WSDLException e) {
    throw new WSDLGenerationException(e);
  }
}

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

public Port createPort(Definition definition, Binding binding, Service service, String uri) {
  try {
    Port port = definition.createPort();
    port.setBinding(binding);
    configurePort(port, binding);
    if (uri != null) {
      ExtensibilityElement portExtension =
        definition.getExtensionRegistry().createExtension(Port.class, soapAddress);
      if (requiresSOAP12) {
        ((SOAP12Address)portExtension).setLocationURI(uri);
      } else {
        ((SOAPAddress)portExtension).setLocationURI(uri);
      }
      port.addExtensibilityElement(portExtension);
    }
    service.addPort(port);
    return port;
  } catch (WSDLException e) {
    throw new WSDLGenerationException(e);
  }
}

代码示例来源:origin: org.objectweb.celtix/celtix-tools

private void setAddrElement() throws ToolException {
  extReg = this.wsdlReader.getExtensionRegistry();
  if (extReg == null) {
    extReg = wsdlFactory.newPopulatedExtensionRegistry();
  }
  XMLHttpAddress xmlHttpAddress = null;
  try {
    xmlHttpAddress = (XMLHttpAddress)extReg.createExtension(Port.class,
                                WSDLConstants.NS_XMLHTTP_BINDING_ADDRESS);
  } catch (WSDLException wse) {
    Message msg = new Message("FAIl_TO_CREATE_SOAPADDRESS", LOG);
    throw new ToolException(msg);
  }
  if (env.get(ToolConstants.CFG_ADDRESS) != null) {
    xmlHttpAddress.setLocation((String)env.get(ToolConstants.CFG_ADDRESS));
  } else {
    xmlHttpAddress.setLocation(HTTP_PREFIX + "/" + env.get(ToolConstants.CFG_SERVICE) + "/"
                  + env.get(ToolConstants.CFG_PORT));
  }
  port.addExtensibilityElement(xmlHttpAddress);
}

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

public Port createPort(WSDLBuilder builder, javax.wsdl.Binding wbinding)
  {
    Transport t = builder.getTransportManager().getTransport(getBindingId());
    if (!(t instanceof WSDL11Transport)) return null;
    
    WSDL11Transport transport = (WSDL11Transport) t;
    
    SOAPAddressImpl add = new SOAPAddressImpl();
    add.setLocationURI(transport.getServiceURL(builder.getService()));
    
    Port port = builder.getDefinition().createPort();
    port.setBinding( wbinding );
    QName portName = (QName) builder.getService().getProperty(ObjectServiceFactory.PORT_NAME);
    if (portName != null)
    {
      port.setName(portName.getLocalPart());   
    }
    else
    {
      port.setName( builder.getService().getSimpleName() + transport.getName() + "Port" );
    }
    port.addExtensibilityElement( add );
        return port;
  }
}

相关文章