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

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

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

Client.getOutInterceptors介绍

暂无

代码示例

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

private void initIntercepors(Client client, AbstractBasicInterceptorProvider clientFact) {
  client.getInInterceptors().addAll(clientFact.getInInterceptors());
  client.getOutInterceptors().addAll(clientFact.getOutInterceptors());
  client.getInFaultInterceptors().addAll(clientFact.getInFaultInterceptors());
  client.getOutFaultInterceptors().addAll(clientFact.getOutFaultInterceptors());
}

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

Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new GZIPInInterceptor());
client.getOutInterceptors().add(new GZIPOutInterceptor());

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

} else if (m == Service.Mode.MESSAGE) {
  SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
  client.getOutInterceptors().add(saajOut);
  client.getOutInterceptors().
    add(new MessageModeOutInterceptor(saajOut,
                     client.getEndpoint()

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

public List<Interceptor<? extends Message>> getOutInterceptors() {
  if (client != null) {
    return client.getOutInterceptors();
  }
  return out;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security

public List<Interceptor<? extends Message>> getOutInterceptors() {
  if (client != null) {
    return client.getOutInterceptors();
  }
  return out;
}

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

MAPCodec getMAPCodec(Client port) {
  for (Interceptor<? extends Message> f : port.getOutInterceptors()) {
    if (f instanceof MAPCodec) {
      return (MAPCodec)f;
    }
  }
  return null;
}

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

// create the client stub
 MyService service = new MyService();
 MyServicePort stub = service.getMyServicePort();
 // configure UsernameToken security handling
 Map<String, Object> props = new HashMap<String, Object>();
 props.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
 props.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
 props.put(WSHandlerConstants.USER, "XYZ");
 props.put(WSHandlerConstants.PW_CALLBACK_CLASS, PasswordHandler.class.getName());
 WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(props);
 Client client = ClientProxy.getClient(stub);
 client.getOutInterceptors().add(wssOut);

代码示例来源:origin: fi.vm.sade.generic/generic-test-support

/**
 * Adds interceptor to listen, how many times client has been called.
 * @param client
 */
public static void expectCall(Object client) {
  Client cxfClient = ClientProxy.getClient(client);
  CounterInterceptor counterInterceptor = new CounterInterceptor(Phase.POST_PROTOCOL);
  cxfClient.getOutInterceptors().add(counterInterceptor);
  counterInterceptors.put(cxfClient, counterInterceptor);
}

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

@Override
public void initialize(Client client, Bus bus) {
  createDefaultProvidersIfNeeded(bus);
  //can optimize for client case and just put interceptors it needs
  MetricsMessageOutInterceptor out = new MetricsMessageOutInterceptor(providers);
  CountingOutInterceptor countingOut = new CountingOutInterceptor();
  client.getInInterceptors().add(new MetricsMessageInInterceptor(providers));
  client.getInInterceptors().add(new MetricsMessageInPostInvokeInterceptor(providers));
  client.getInFaultInterceptors().add(new MetricsMessageInPostInvokeInterceptor(providers));
  client.getOutInterceptors().add(countingOut);
  client.getOutInterceptors().add(out);
  client.getOutInterceptors().add(new MetricsMessageClientOutInterceptor(providers));
}

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

// output log using log4j
//LogUtils.setLoggerClass(org.apache.cxf.common.logging.Log4jLogger.class);
yourService = new YourService(wsdlURL, SERVICE_NAME);
port = yourService.getServicePort(); 

Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());

代码示例来源:origin: org.mule.services/mule-service-soap

private void addSecurityInterceptors(Client client, List<SecurityStrategyCxfAdapter> securityStrategies) {
 Map<String, Object> requestProps = buildSecurityProperties(securityStrategies, SecurityStrategyType.OUTGOING);
 if (!requestProps.isEmpty()) {
  client.getOutInterceptors().add(new WSS4JOutInterceptor(requestProps));
 }
 Map<String, Object> responseProps = buildSecurityProperties(securityStrategies, SecurityStrategyType.INCOMING);
 if (!responseProps.isEmpty()) {
  client.getInInterceptors().add(new WSS4JInInterceptor(responseProps));
 }
}

代码示例来源:origin: todvora/eet-client

/**
 * Sign our request with the client key par.
 */
private void configureSigning(final Client clientProxy) {
  final WSS4JOutInterceptor wssOut = createSigningInterceptor();
  clientProxy.getOutInterceptors().add(wssOut);
  final WSS4JInInterceptor wssIn = createValidatingInterceptor();
  clientProxy.getInInterceptors().add(wssIn);
  clientProxy.getInInterceptors().add(new SignatureFaultInterceptor());
}

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

private void initIntercepors(Client client, AbstractBasicInterceptorProvider clientFact) {
  client.getInInterceptors().addAll(clientFact.getInInterceptors());
  client.getOutInterceptors().addAll(clientFact.getOutInterceptors());
  client.getInFaultInterceptors().addAll(clientFact.getInFaultInterceptors());
  client.getOutFaultInterceptors().addAll(clientFact.getOutFaultInterceptors());
}

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

private WSS4JOutInterceptor addToClient(Object svc) {
  Client client = ClientProxy.getClient(svc);
  WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor();
  client.getEndpoint().getOutInterceptors().add(wssOut);
  client.getOutInterceptors().add(wssOut);
  return wssOut;
}

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

@Test
public void testArgfiles() throws Exception {
  System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true");
  JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
  Client client = dcf.createClient(new URL("http://localhost:"
                       + PORT1 + "/ArrayService?wsdl"));
  String[] values = new String[] {"foobar", "something" };
  List<String> list = Arrays.asList(values);
  client.getOutInterceptors().add(new LoggingOutInterceptor());
  client.getInInterceptors().add(new LoggingInInterceptor());
  client.invoke("init", list);
}

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

@Test
public void testArrayList() throws Exception {
  JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
  Client client = dcf.createClient(new URL("http://localhost:"
                       + PORT1 + "/ArrayService?wsdl"));
  String[] values = new String[] {"foobar", "something" };
  List<String> list = Arrays.asList(values);
  client.getOutInterceptors().add(new LoggingOutInterceptor());
  client.getInInterceptors().add(new LoggingInInterceptor());
  client.invoke("init", list);
}

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

@Before
public void setUp() throws Exception {
  URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
  greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
  BindingProvider bp = (BindingProvider)greeter;
  ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
  ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
  bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                ADDRESS);
  bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
  bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
}

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

@Before
public void setUp() throws Exception {
  URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
  greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
  BindingProvider bp = (BindingProvider)greeter;
  ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
  ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
  bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                ADDRESS);
  bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
  bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
}

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

@Override
public void initialize(Client client, Bus bus) {
  //check if there is logging interceptor
  removeInterceptorWhichIsOutThePhases(client.getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
  removeInterceptorWhichIsOutThePhases(client.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
  client.getEndpoint().getBinding().getInInterceptors().clear();
  //we need to keep the LoggingOutputInterceptor
  getOutInterceptorNames().add(LoggingOutInterceptor.class.getName());
  removeInterceptorWhichIsOutThePhases(client.getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
  removeInterceptorWhichIsOutThePhases(client.getEndpoint().getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
  client.getEndpoint().getBinding().getOutInterceptors().clear();
  client.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
}

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

@Test
public void testClientOutTransformation() {
  Service service = Service.create(SERVICE_NAME);
  String endpoint = "http://localhost:" + PORT + "/EchoContext/EchoPort";
  service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpoint);
  Echo port = service.getPort(PORT_NAME, Echo.class);
  Client client = ClientProxy.getClient(port);
  XSLTOutInterceptor outInterceptor = new XSLTOutInterceptor(XSLT_REQUEST_PATH);
  client.getOutInterceptors().add(outInterceptor);
  String response = port.echo("test");
  assertTrue("Request was not transformed", response.contains(TRANSFORMED_CONSTANT));
}

相关文章