javax.xml.ws.Binding类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(170)

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

Binding介绍

[英]The Binding interface is the base interface for JAX-WS protocol bindings.
[中]绑定接口是JAX-WS协议绑定的基本接口。

代码示例

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

@Advice.OnMethodExit
private static void setHandlerChain(@Advice.Return Object portOrDispatch) {
  if (portOrDispatch instanceof BindingProvider) {
    final Binding binding = ((BindingProvider) portOrDispatch).getBinding();
    final List<Handler> handlerChain = binding.getHandlerChain();
    if (handlerChain != null) {
      binding.setHandlerChain(handlerChain);
    } else {
      binding.setHandlerChain(new ArrayList<Handler>());
    }
  }
}

代码示例来源:origin: stackoverflow.com

final Binding binding = ((BindingProvider) servicePort).getBinding();
List<Handler> handlerList = binding.getHandlerChain();
if (handlerList == null)
  handlerList = new ArrayList<Handler>();

handlerList.add(new SecurityHandler());
binding.setHandlerChain(handlerList); // <- important!

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-etk

@SuppressWarnings("unchecked")
private void configureBindingProvider(BindingProvider bindingProvider,
    String location) {
  bindingProvider.getRequestContext().put(
      BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);
  Binding binding = bindingProvider.getBinding();
  @SuppressWarnings("rawtypes")
  List handlerChain = binding.getHandlerChain();
  handlerChain.add(new LoggingHandler());
  handlerChain.add(this.payloadLogicalHandler);
  binding.setHandlerChain(handlerChain);
}

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

/**
 * Configures binding handlers.
 *
 * @param provider the binding provider for the invocation
 */
protected void configureHandlers(BindingProvider provider) {
  if (handlers == null) {
    return;
  }
  String endpointPath = (String) provider.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
  if (endpointPath == null) {
    // Nothing to bind
    return;
  }
  provider.getBinding().setHandlerChain(handlers);
}

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

@Test
public void test() throws Exception {
  QName serviceName = new QName("http://www.jboss.org/jbossas/quickstarts/wshelloworld/HelloWorld", "HelloWorldService");
  Service service = Service.create(new URL("http://localhost:" + getPort()), serviceName);
  HelloWorldService helloWorldService = service.getPort(HelloWorldService.class);
  assertThat(helloWorldService).isInstanceOf(BindingProvider.class);
  final BindingProvider bindingProvider = (BindingProvider) helloWorldService;
  boolean clientHandlerFound = false;
  for (Handler handler : bindingProvider.getBinding().getHandlerChain()) {
    if (handler instanceof TracingClientSOAPHandler) {
      clientHandlerFound = true;
    }
  }
  assertThat(clientHandlerFound).overridingErrorMessage("No %s found in %s",
      TracingClientSOAPHandler.class.getSimpleName(),
      bindingProvider.getBinding().getHandlerChain()).isTrue();
}

代码示例来源:origin: stackoverflow.com

ServicePort port = service.getServicePort();
BindingProvider bindingProvider = (BindingProvider) port;
Binding binding = bindingProvider.getBinding();
binding.setHandlerChain(Collections.singletonList(new NamespaceBindingShim()));

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

public Set<QName> getUnderstoodHeaders() {
  Set<QName> understood = new HashSet<>();
  for (Handler<?> h : getBinding().getHandlerChain()) {
    if (h instanceof SOAPHandler) {
      Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders());
      if (headers != null) {
        understood.addAll(headers);
      }
    }
  }
  return understood;
}

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

/**
 * Obtain handler chain from annotations.
 * @param server
 *
 */
private void buildHandlerChain(Server server) {
  AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
  @SuppressWarnings("rawtypes")
  List<Handler> chain = new ArrayList<>(handlers);
  chain.addAll(builder.buildHandlerChainFromClass(getServiceBeanClass(),
                          server.getEndpoint().getEndpointInfo().getName(),
                          server.getEndpoint().getService().getName(),
                          this.getBindingId()));
  for (Handler<?> h : chain) {
    injectResources(h);
  }
  ((JaxWsEndpointImpl)server.getEndpoint()).getJaxwsBinding().setHandlerChain(chain);
}

代码示例来源:origin: org.jboss.ws/jbossws-common

/**
* Setups a given Binding instance using a specified CommonConfig
* 
* @param binding    the Binding instance to setup
* @param config     the CommonConfig with the input configuration
*/
@SuppressWarnings("rawtypes")
public void setupConfigHandlers(Binding binding, CommonConfig config)
{
 if (config != null) {
   //start with the use handlers only to remove the previously set configuration
   List<Handler> userHandlers = getNonConfigHandlers(binding.getHandlerChain());
   List<Handler> handlers = convertToHandlers(config.getPreHandlerChains(), binding.getBindingID(), true); //PRE
   handlers.addAll(userHandlers); //ENDPOINT
   handlers.addAll(convertToHandlers(config.getPostHandlerChains(), binding.getBindingID(), false)); //POST
   binding.setHandlerChain(handlers);
 }
}

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

String bindingId = endpoint.getJaxwsBinding().getBindingID();

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-ehealthbox

@SuppressWarnings("unchecked")
private void configureBindingProvider(BindingProvider bindingProvider,
    String location) {
  bindingProvider.getRequestContext().put(
      BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);
  Binding binding = bindingProvider.getBinding();
  @SuppressWarnings("rawtypes")
  List handlerChain = binding.getHandlerChain();
  handlerChain.add(this.wsSecuritySOAPHandler);
  handlerChain.add(this.inboundAttachmentsSOAPHandler);
  // handlerChain.add(new LoggingHandler());
  // LoggingHandler makes CXF fail on the attachments.
  // https://issues.apache.org/jira/browse/CXF-5496
  binding.setHandlerChain(handlerChain);
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-ws

/**
 * Configures binding handlers.
 *
 * @param provider the binding provider for the invocation
 */
protected void configureHandlers(BindingProvider provider) {
  if (handlers == null) {
    return;
  }
  String endpointPath = (String) provider.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
  if (endpointPath == null) {
    // Nothing to bind
    return;
  }
  provider.getBinding().setHandlerChain(handlers);
}

代码示例来源:origin: stackoverflow.com

// HandlerChain installieren
Binding binding = ((BindingProvider) port).getBinding();
List hchain = binding.getHandlerChain();
if (hchain == null) {
 hchain = new ArrayList();
}
hchain.add(new HTTPUserAgentHandler());
binding.setHandlerChain(hchain);

代码示例来源:origin: org.kantega.respiro/respiro-cxf-plugin

private void configureHandlerChain(BindingProvider port) {
  if(this.handlerChain != null) {
    final List<Handler> handlerChain = port.getBinding().getHandlerChain();
    handlerChain.addAll(this.handlerChain);
  }
}

代码示例来源:origin: stackoverflow.com

ProcessEngineServiceProxy pewsServiceProxy = new ProcessEngineServiceProxy();
pewsServiceProxy._getDescriptor().setEndpoint(url);

// install the handler chain
BindingProvider bp = (BindingProvider) pewsServiceProxy._getDescriptor().getProxy();
Binding pewsBinding = bp.getBinding();
List<Handler> handlerChain = new java.util.ArrayList<Handler>();
PEWSClientHeaderHandler wsSecurity = new PEWSClientHeaderHandler();
handlerChain.add(wsSecurity);
pewsBinding.setHandlerChain(handlerChain);

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

public Set<QName> getUnderstoodHeaders() {
  Set<QName> understood = new HashSet<>();
  for (Handler<?> h : getBinding().getHandlerChain()) {
    if (h instanceof SOAPHandler) {
      Set<QName> headers = CastUtils.cast(((SOAPHandler<?>) h).getHeaders());
      if (headers != null) {
        understood.addAll(headers);
      }
    }
  }
  return understood;
}

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

private void buildHandlerChain(JaxWsClientProxy cp) {
  AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder();
  JaxWsServiceFactoryBean sf = (JaxWsServiceFactoryBean)getServiceFactory();
  @SuppressWarnings("rawtypes")
  List<Handler> chain = new ArrayList<>(handlers);
  if (loadHandlers) {
    chain.addAll(builder.buildHandlerChainFromClass(sf.getServiceClass(),
                            sf.getEndpointInfo().getName(),
                            sf.getServiceQName(),
                            this.getBindingId()));
  }
  if (!chain.isEmpty()) {
    ResourceManager resourceManager = getBus().getExtension(ResourceManager.class);
    List<ResourceResolver> resolvers = resourceManager.getResourceResolvers();
    resourceManager = new DefaultResourceManager(resolvers);
    resourceManager.addResourceResolver(new WebServiceContextResourceResolver());
    ResourceInjector injector = new ResourceInjector(resourceManager);
    for (Handler<?> h : chain) {
      if (Proxy.isProxyClass(h.getClass()) && getServiceClass() != null) {
        injector.inject(h, getServiceClass());
        injector.construct(h, getServiceClass());
      } else {
        injector.inject(h);
        injector.construct(h);
      }
    }
  }
  cp.getBinding().setHandlerChain(chain);
}

代码示例来源:origin: Talend/components

protected void publish() throws Exception {
  int portNumber = FreePortFinder.findFreePort(28080, FreePortFinder.MAX_PORT_NUMBER);
  URL endpointAddress = new URL("http://localhost:" + portNumber + "/services/" + portName);
  logger.info("Endpoint address: {}", endpointAddress);
  portMockAdapter = portAdapterClass.newInstance();
  portMockAdapter.setEndpointAddress(endpointAddress);
  // Publish the SOAP Web Service
  endpoint = Endpoint.publish(endpointAddress.toString(), portMockAdapter);
  assertTrue(endpoint.isPublished());
  assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http", endpoint.getBinding().getBindingID());
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-gen-ins

private void configureBindingProvider(BindingProvider bindingProvider,
    String location) {
  bindingProvider.getRequestContext().put(
      BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);
  Binding binding = bindingProvider.getBinding();
  List handlerChain = binding.getHandlerChain();
  handlerChain.add(this.wsSecuritySOAPHandler);
  handlerChain.add(new LoggingHandler());
  binding.setHandlerChain(handlerChain);
}

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-saml2

protected void registerSoapHandler(SOAPHandler soapHandler) {
  BindingProvider bindingProvider = (BindingProvider) this.port;
  Binding binding = bindingProvider.getBinding();
  @SuppressWarnings("unchecked")
  List<Handler> handlerChain = binding.getHandlerChain();
  handlerChain.add(soapHandler);
  binding.setHandlerChain(handlerChain);
}

相关文章