org.apache.cxf.endpoint.Client.getBus()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(177)

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

Client.getBus介绍

[英]Retrieves the Bus that was used to create the Client
[中]检索用于创建客户端的总线

代码示例

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

= ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
List<Feature> allFeatures;
if (client.getBus().getFeatures() != null) {
  allFeatures = new ArrayList<>(endpointFeatures.size()
    + client.getBus().getFeatures().size());
  allFeatures.addAll(endpointFeatures);
  allFeatures.addAll(client.getBus().getFeatures());
} else {
  allFeatures = endpointFeatures;

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

Client client = ClientProxy.getClient(port);
         Bus bus = client.getBus();
         PolicyInterceptorProviderRegistry pipr = bus.getExtension(PolicyInterceptorProviderRegistry.class);

QName ntmlIgnore = new QName("http://schemas.microsoft.com/ws/06/2004/policy/http", "NtlmAuthentication");
interceptorRegProvider.register(new IgnorablePolicyInterceptorProvider(ntmlIgnore));

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

public void setConfigProperties(Client client, Map<String, String> properties) {
 client.getEndpoint().putAll(properties);
 InterceptorUtils.addInterceptors(client, properties);
 FeatureUtils.addFeatures(client, client.getBus(), properties);
}

代码示例来源:origin: org.apache.cxf.services.ws-discovery/cxf-services-ws-discovery-api

public void addVersionTransformer(Dispatch<Object> dispatch) {
  StaxTransformFeature feature = new StaxTransformFeature();
  Map<String, String> outElements = new HashMap<>();
  outElements.put("{" + NS_1_1 + "}*",
          "{" + NS_1_0 + "}*");
  outElements.put("{" + INSTANCE_1_1.getAddressingNamespace() + "}*",
          "{" + getAddressingNamespace() + "}*");
  feature.setOutTransformElements(outElements);
  Map<String, String> inElements = new HashMap<>();
  inElements.put("{" + NS_1_0 + "}*",
          "{" + NS_1_1 + "}*");
  inElements.put("{" + getAddressingNamespace() + "}*",
          "{" + INSTANCE_1_1.getAddressingNamespace() + "}*");
  feature.setInTransformElements(inElements);
  feature.initialize(((DispatchImpl)dispatch).getClient(),
            ((DispatchImpl)dispatch).getClient().getBus());
  Map<String, String> nsMap = new HashMap<>();
  nsMap.put("tns", NS_1_0);
  nsMap.put("wsa", getAddressingNamespace());
  ((DispatchImpl)dispatch).getClient().getEndpoint().getEndpointInfo()
    .setProperty("soap.env.ns.map", nsMap);
}
public QName getServiceName() {

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

public void addVersionTransformer(Dispatch<Object> dispatch) {
  StaxTransformFeature feature = new StaxTransformFeature();
  Map<String, String> outElements = new HashMap<>();
  outElements.put("{" + NS_1_1 + "}*",
          "{" + NS_1_0 + "}*");
  outElements.put("{" + INSTANCE_1_1.getAddressingNamespace() + "}*",
          "{" + getAddressingNamespace() + "}*");
  feature.setOutTransformElements(outElements);
  Map<String, String> inElements = new HashMap<>();
  inElements.put("{" + NS_1_0 + "}*",
          "{" + NS_1_1 + "}*");
  inElements.put("{" + getAddressingNamespace() + "}*",
          "{" + INSTANCE_1_1.getAddressingNamespace() + "}*");
  feature.setInTransformElements(inElements);
  feature.initialize(((DispatchImpl)dispatch).getClient(),
            ((DispatchImpl)dispatch).getClient().getBus());
  Map<String, String> nsMap = new HashMap<>();
  nsMap.put("tns", NS_1_0);
  nsMap.put("wsa", getAddressingNamespace());
  ((DispatchImpl)dispatch).getClient().getEndpoint().getEndpointInfo()
    .setProperty("soap.env.ns.map", nsMap);
}
public QName getServiceName() {

代码示例来源:origin: Talend/tesb-rt-se

public <T> Dispatch<T> configureDispatch(Dispatch<T> dispatch) {
  if (jmsConfiguration == null || !(dispatch instanceof DispatchImpl<?>) ||
      (serviceName == null && configuration == null)) {
    return null;
  }
  if (!jmsConfigured) {
    setupJmsConfiguration();
  }
  final DispatchImpl<?> di = (DispatchImpl<?>) dispatch;
  final Client cl = di.getClient();
  final JMSConfigFeature feature = new JMSConfigFeature();
  feature.setJmsConfig(jmsConfiguration);
  feature.initialize(cl, cl.getBus());
  return dispatch;
}

代码示例来源:origin: Talend/tesb-rt-se

public static void setupDispatch(final Dispatch<?> dispatch) {
  if (!(dispatch instanceof DispatchImpl)) {
    throw new IllegalArgumentException("Only CXF JAX-WS Dispatch supported. ");
  }
  final DispatchImpl<?> dsp = (DispatchImpl<?>) dispatch;
  final Client dispatchClient = dsp.getClient();
  final Bus bus = dispatchClient.getBus();
  (new RequestCallbackFeature()).initialize(dispatchClient, bus);
  if (logging) {
    (new LoggingFeature()).initialize(dispatchClient, bus);
  }
  if (serviceActivityMonitoring) {
    getEventFeature().initialize(dispatchClient, bus);
  }
}

代码示例来源:origin: Talend/tesb-rt-se

public <T> void setupCallbackProxy(final T proxy) {
  final Client client = ClientProxy.getClient(proxy);
  final Bus bus = client.getBus();
  (new RequestCallbackFeature()).initialize(client, bus);
  if (logging) {
    (new LoggingFeature()).initialize(client, bus);
  }
  if (serviceActivityMonitoring) {
    getEventFeature().initialize(client, bus);
  }
  final BindingProvider bp = (BindingProvider) proxy;
  bp.getRequestContext().put(
      JaxWsClientProxy.THREAD_LOCAL_REQUEST_CONTEXT, Boolean.TRUE);
  bp.getRequestContext().put(
      BindingProvider.ENDPOINT_ADDRESS_PROPERTY, replyToAddress);
  bp.getRequestContext().put(
      RequestCallbackFeature.CALLCONTEXT_PROPERTY_NAME, this);
}

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

= ((JaxWsClientEndpointImpl)client.getEndpoint()).getFeatures();
List<Feature> allFeatures;
if (client.getBus().getFeatures() != null) {
  allFeatures = new ArrayList<>(endpointFeatures.size()
    + client.getBus().getFeatures().size());
  allFeatures.addAll(endpointFeatures);
  allFeatures.addAll(client.getBus().getFeatures());
} else {
  allFeatures = endpointFeatures;

代码示例来源:origin: Talend/tesb-rt-se

public <T> Dispatch<T> configureDispatch(Dispatch<T> dispatch, String addressing) {
  if (configuration == null) {
    if (serviceName == null) {
      return null;
    }
    configuration = CallContext.resolveConfiguration(serviceName);
  }
  String overrideAddress = getProperty("requestURI2010");
  if (overrideAddress != null &&
      (overrideAddress.equals(addressing) ||
          OVERRIDE_BY_URI_CONFIG.equals(addressing))) {
    return dispatch;
  }
  if (jmsConfiguration == null || !(dispatch instanceof DispatchImpl<?>) ||
      (serviceName == null && configuration == null)) {
    return null;
  }
  if (!jmsConfigured) {
    setupJmsConfiguration();
  }
  final DispatchImpl<?> di = (DispatchImpl<?>) dispatch;
  final Client cl = di.getClient();
  final JMSConfigFeature feature = new JMSConfigFeature();
  feature.setJmsConfig(jmsConfiguration);
  feature.initialize(cl, cl.getBus());
  return dispatch;
}

代码示例来源:origin: org.openehealth.ipf.commons/ipf-commons-ihe-ws

for (AbstractFeature feature : features) {
  client.getEndpoint().getActiveFeatures().add(feature);
  feature.initialize(client, client.getBus());

代码示例来源:origin: org.talend.esb/sam-agent

Bus bus = client.getBus();

代码示例来源:origin: Talend/tesb-rt-se

Bus bus = client.getBus();

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

protected void enableWSAForCurrentEndpoint() {
  Endpoint provider = ClientProxy.getClient(greeter).getEndpoint();
  mapAggregator = new MAPAggregator();
  mapCodec = MAPCodec.getInstance(ClientProxy.getClient(greeter).getBus());
  provider.getInInterceptors().add(mapAggregator);
  provider.getInInterceptors().add(mapCodec);
  provider.getOutInterceptors().add(mapAggregator);
  provider.getOutInterceptors().add(mapCodec);
  provider.getInFaultInterceptors().add(mapAggregator);
  provider.getInFaultInterceptors().add(mapCodec);
  provider.getOutFaultInterceptors().add(mapAggregator);
  provider.getOutFaultInterceptors().add(mapCodec);
}

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

protected void enableWSAForCurrentEndpoint() {
  Endpoint provider = ClientProxy.getClient(greeter).getEndpoint();
  mapAggregator = new MAPAggregator();
  mapCodec = MAPCodec.getInstance(ClientProxy.getClient(greeter).getBus());
  provider.getInInterceptors().add(mapAggregator);
  provider.getInInterceptors().add(mapCodec);
  provider.getOutInterceptors().add(mapAggregator);
  provider.getOutInterceptors().add(mapCodec);
  provider.getInFaultInterceptors().add(mapAggregator);
  provider.getInFaultInterceptors().add(mapCodec);
  provider.getOutFaultInterceptors().add(mapAggregator);
  provider.getOutFaultInterceptors().add(mapCodec);
}

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

@Test
  public void testEchoProviderAsyncDecoupledEndpoints() throws Exception {
    String requestString = "<echo/>";
    Service service = Service.create(serviceName);
    service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
            "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
    Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
                                  StreamSource.class,
                                  Service.Mode.PAYLOAD,
                                  new LoggingFeature());

    Client client = ((DispatchImpl<StreamSource>)dispatcher).getClient();
    WSAddressingFeature wsAddressingFeature = new WSAddressingFeature();
    wsAddressingFeature.initialize(client, client.getBus());
    dispatcher.getRequestContext().put("org.apache.cxf.ws.addressing.replyto",
                      "http://localhost:" + CLIENT_PORT
                        + "/SoapContext/AsyncEchoClient");

    StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
    StreamSource response = dispatcher.invoke(request);

    assertEquals(requestString, StaxUtils.toString(response));
  }
}

代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-client-bindings

Bus bus = client.getBus();

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

@Test
public void testDynamicClientFactory() throws Exception {
  URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
  assertNotNull(wsdl);
  String wsdlUrl = null;
  wsdlUrl = wsdl.toURI().toString();
  DynamicClientFactory dcf = DynamicClientFactory.newInstance();
  Client client = dcf.createClient(wsdlUrl, serviceName, portName);
  updateAddressPort(client, PORT);
  client.invoke("greetMe", "test");
  Object[] result = client.invoke("sayHi");
  assertNotNull("no response received from service", result);
  assertEquals("Bonjour", result[0]);
  client = dcf.createClient(wsdlUrl, serviceName, portName);
  new LoggingFeature().initialize(client, client.getBus());
  updateAddressPort(client, PORT);
  client.invoke("greetMe", "test");
  result = client.invoke("sayHi");
  assertNotNull("no response received from service", result);
  assertEquals("Bonjour", result[0]);
}

相关文章