本文整理汇总了Java中org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor类的典型用法代码示例。如果您正苦于以下问题:Java SAAJOutInterceptor类的具体用法?Java SAAJOutInterceptor怎么用?Java SAAJOutInterceptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SAAJOutInterceptor类属于org.apache.cxf.binding.soap.saaj包,在下文中一共展示了SAAJOutInterceptor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupEndpoint
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
protected void setupEndpoint(Endpoint ep) {
resetPartTypes(ep.getBinding());
Class<?> fmt = Source.class;
if (ep.getBinding() instanceof SoapBinding) {
ep.getInInterceptors().add(new SAAJInInterceptor());
SAAJOutInterceptor out = new SAAJOutInterceptor();
ep.getOutInterceptors().add(out);
ep.getOutInterceptors().add(new CxfMessageSoapHeaderOutInterceptor());
ep.getOutInterceptors().add(new MessageModeOutInterceptor(out, ep.getBinding().getBindingInfo().getName()));
fmt = SOAPMessage.class;
} else {
ep.getOutInterceptors().add(new MessageModeOutInterceptor(Source.class, ep.getBinding().getBindingInfo().getName()));
}
ep.getInInterceptors().add(new MessageModeInInterceptor(fmt, ep.getBinding().getBindingInfo().getName()));
ep.put(AbstractInDatabindingInterceptor.NO_VALIDATE_PARTS, Boolean.TRUE);
// need to remove the wrapper class and holder interceptor
removeInterceptors(ep.getInInterceptors(), REMOVING_IN_INTERCEPTORS);
removeInterceptors(ep.getOutInterceptors(), REMOVING_OUT_INTERCEPTORS);
}
示例2: setupWSS4JChain
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public static final void setupWSS4JChain(InterceptorProvider endpoint, Map<String, Object> inProps, Map<String, Object> outProps) {
if (null != inProps && !inProps.isEmpty()) {
endpoint.getInInterceptors().add(new SAAJInInterceptor());
endpoint.getInInterceptors().add(new WSS4JInInterceptor(inProps));
// if WS Security is used with a JAX-WS handler (See EjbInterceptor), we have to deal with mustUnderstand flag
// in WS Security headers. So, let's add an interceptor
endpoint.getInInterceptors().add(new WSSPassThroughInterceptor());
}
if (null != outProps && !outProps.isEmpty()) {
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
endpoint.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
}
}
示例3: appendAuth
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
/**
* 添加用户名和密码信息
*
* @param jw
*/
public void appendAuth(JaxWsProxyFactoryBean jw, String nodeId) {
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, RmClusterConfig.getSingleton().getAuth(nodeId).keySet().toArray(new String[0])[0]);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, RmPasswordCallback.class.getName());
Map<String, Object> mProp = new HashMap<String, Object>();
mProp.put(FaultListener.class.getName(), new FaultListener() {
public boolean faultOccurred(Exception exception, String description, Message message) {
RmCacheHandler.logCache.error("fail: " + exception.toString() + " cause:" + exception.getCause());
return false;
}
});
jw.setProperties(mProp);
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
jw.getOutInterceptors().add(wssOut);
jw.getOutInterceptors().add(new SAAJOutInterceptor());
}
示例4: chainAlreadyContainsSAAJ
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
private static boolean chainAlreadyContainsSAAJ(SoapMessage message)
{
ListIterator<Interceptor<? extends Message>> listIterator = message.getInterceptorChain().getIterator();
while (listIterator.hasNext())
{
if (listIterator.next() instanceof SAAJOutInterceptor)
{
return true;
}
}
return false;
}
示例5: handleMessage
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
if (message.getContent(SOAPMessage.class) == null)
{
SAAJOutInterceptor saajout = new SAAJOutInterceptor();
saajout.handleMessage(message);
}
authManager.validateResponse(message);
}
示例6: testCalculatorViaWsInterface
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterface() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImpl?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "jane");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("waterfall");
}
});
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(10, calc.sum(4, 6));
}
示例7: testCalculatorViaWsInterfaceWithTimestamp1way
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithTimestamp1way() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplTimestamp1way?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplTimestamp1way");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(12, calc.multiply(3, 4));
}
示例8: testCalculatorViaWsInterfaceWithTimestamp2ways
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithTimestamp2ways() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplTimestamp2ways?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplTimestamp2ways");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
endpoint.getInInterceptors().add(new SAAJInInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
final Map<String, Object> inProps = new HashMap<String, Object>();
inProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
final WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
endpoint.getInInterceptors().add(wssIn);
assertEquals(12, calc.multiply(3, 4));
}
示例9: testCalculatorViaWsInterfaceWithUsernameTokenPlainPassword
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithUsernameTokenPlainPassword() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplUsernameTokenPlainPassword?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPassword");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "jane");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("waterfall");
}
});
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(10, calc.sum(4, 6));
}
示例10: testCalculatorViaWsInterfaceWithUsernameTokenHashedPassword
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithUsernameTokenHashedPassword() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplUsernameTokenHashedPassword?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplUsernameTokenHashedPassword");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "jane");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("waterfall");
}
});
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(10, calc.sum(4, 6));
}
示例11: testCalculatorViaWsInterfaceWithSign
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithSign() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplSign?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplSign");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
outProps.put(WSHandlerConstants.USER, "clientalias");
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("clientPassword");
}
});
outProps.put(WSHandlerConstants.SIG_PROP_FILE, "META-INF/CalculatorImplSign-client.properties");
outProps.put(WSHandlerConstants.SIG_KEY_ID, "IssuerSerial");
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(24, calc.multiply(4, 6));
}
示例12: CxfMessageSoapHeaderOutInterceptor
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public CxfMessageSoapHeaderOutInterceptor() {
super(Phase.PRE_PROTOCOL);
addAfter(SAAJOutInterceptor.class.getName());
}
示例13: JaspiClientInInterceptor
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public JaspiClientInInterceptor(JaspiClientAuthenticator authManager)
{
super(Phase.POST_PROTOCOL_ENDING);
addAfter(SAAJOutInterceptor.SAAJOutEndingInterceptor.class.getName());
this.authManager = authManager;
}
示例14: testCalculatorViaWsInterfaceWithUsernameTokenPlainPasswordEncrypt
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; //导入依赖的package包/类
public void testCalculatorViaWsInterfaceWithUsernameTokenPlainPasswordEncrypt() throws Exception {
final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplUsernameTokenPlainPasswordEncrypt?wsdl"),
new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
assertNotNull(calcService);
// for debugging (ie. TCPMon)
calcService.addPort(new QName("http://superbiz.org/wsdl",
"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
"http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPasswordEncrypt");
// CalculatorWs calc = calcService.getPort(
// new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
// CalculatorWs.class);
final CalculatorWs calc = calcService.getPort(CalculatorWs.class);
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
+ " " + WSHandlerConstants.ENCRYPT);
outProps.put(WSHandlerConstants.USER, "jane");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("waterfall");
}
});
outProps.put(WSHandlerConstants.ENC_PROP_FILE, "META-INF/CalculatorImplUsernameTokenPlainPasswordEncrypt-client.properties");
outProps.put(WSHandlerConstants.ENCRYPTION_USER, "serveralias");
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(10, calc.sum(4, 6));
}