本文整理汇总了Java中javax.xml.ws.Binding类的典型用法代码示例。如果您正苦于以下问题:Java Binding类的具体用法?Java Binding怎么用?Java Binding使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Binding类属于javax.xml.ws包,在下文中一共展示了Binding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import javax.xml.ws.Binding; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() throws APPlatformException, MalformedURLException {
besDAO.configService = confServ;
doReturn(subServ).when(besDAO).getBESWebService(
eq(SubscriptionService.class), any(ServiceInstance.class), any(Optional.class));
doReturn(idServ).when(besDAO).getBESWebService(
eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
doReturn(idServ).when(besDAO).getServicePort(eq(IdentityService.class),
anyMap());
doReturn(subServ).when(besDAO).getServicePort(
eq(SubscriptionService.class), anyMap());
doNothing().when(besDAO).validateVersion(anyString());
Binding mockBinding = mock(Binding.class);
when(idServ.getBinding()).thenReturn(mockBinding);
}
示例2: setupClient
import javax.xml.ws.Binding; //导入依赖的package包/类
protected void setupClient(Object obj, Class<?> seiClass, WebServiceFeature... features) {
Binding binding = ((BindingProvider)obj).getBinding();
Client client = obj instanceof DispatchImpl<?> ? ((DispatchImpl<?>)obj).getClient() : ClientProxy.getClient(obj);
ClientConfig config = readConfig(seiClass);
if (config != null) {
CXFClientConfigurer helper = new CXFClientConfigurer();
helper.setupConfigHandlers(binding, config);
helper.setConfigProperties(client, config.getProperties());
}
client.getOutInterceptors().add(new HandlerChainSortInterceptor(binding)); //add this *after* the config has been set (if any)!
if (features != null) {
for (WebServiceFeature f : features) {
if (f instanceof AbstractClientFeature) {
((AbstractClientFeature)f).initialize(obj);
}
}
}
}
示例3: CertRAClient
import javax.xml.ws.Binding; //导入依赖的package包/类
public CertRAClient(String location) {
CertRaService certRaService = CertRaServiceFactory.newInstance();
this.port = certRaService.getCertRaPort();
BindingProvider bindingProvider = (BindingProvider) this.port;
bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);
Binding binding = bindingProvider.getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new LoggingHandler());
// LoggingHandler makes CXF fail on the attachments.
// https://issues.apache.org/jira/browse/CXF-5496
binding.setHandlerChain(handlerChain);
this.protocolObjectFactory = new be.e_contract.mycarenet.certra.jaxb.protocol.ObjectFactory();
}
示例4: EHealthSTSClient
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* Main constructor.
*
* @param location
* the URL of the eHealth STS web service.
*/
public EHealthSTSClient(String location) {
EHealthSamlStsService service = EHealthSamlStsServiceFactory
.newInstance();
QName portQName = new QName("urn:be:ehealth:saml:sts:1.0",
"EHealthSamlStsPort");
this.dispatch = service.createDispatch(portQName, Source.class,
Service.Mode.PAYLOAD);
this.dispatch.getRequestContext().put(
Dispatch.ENDPOINT_ADDRESS_PROPERTY, location);
Binding binding = dispatch.getBinding();
@SuppressWarnings("rawtypes")
List<Handler> handlerChain = binding.getHandlerChain();
this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();
handlerChain.add(this.wsSecuritySOAPHandler);
handlerChain.add(new LoggingHandler());
binding.setHandlerChain(handlerChain);
}
示例5: XKMSClient
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* Main constructor.
*
* @param location
* the URL of the MyCareNet XKMS web service.
*/
public XKMSClient(String location) {
XMLKeyManagementService service = XKMSServiceFactory.newInstance();
this.port = service.getKeyServiceSoapPort();
BindingProvider bindingProvider = (BindingProvider) this.port;
bindingProvider.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, location);
Binding binding = bindingProvider.getBinding();
@SuppressWarnings("rawtypes")
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new LoggingHandler());
this.proofOfPossessionSignatureSOAPHandler = new ProofOfPossessionSignatureSOAPHandler();
handlerChain.add(this.proofOfPossessionSignatureSOAPHandler);
handlerChain.add(new LoggingHandler());
binding.setHandlerChain(handlerChain);
this.objectFactory = new ObjectFactory();
this.xmldsigObjectFactory = new be.e_contract.mycarenet.jaxb.xmldsig.ObjectFactory();
}
示例6: configureBindingProvider
import javax.xml.ws.Binding; //导入依赖的package包/类
@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);
}
示例7: decorate
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* Decorates a given JAX-WS port with the required security handlers.
*
* @param bindingProvider
* the JAX-WS port to decorate.
* @return the added payload logical JAX-WS handler.
*/
public PayloadLogicalHandler decorate(BindingProvider bindingProvider) {
bindingProvider.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, this.location);
Binding binding = bindingProvider.getBinding();
@SuppressWarnings("rawtypes")
List<Handler> handlerChain = binding.getHandlerChain();
SecuritySOAPHandler sessionKeySignatureSOAPHandler = new SecuritySOAPHandler(
this.sessionKey, this.packageLicenseKey);
handlerChain.add(sessionKeySignatureSOAPHandler);
handlerChain.add(new LoggingHandler());
PayloadLogicalHandler payloadLogicalHandler = new PayloadLogicalHandler();
handlerChain.add(payloadLogicalHandler);
binding.setHandlerChain(handlerChain);
return payloadLogicalHandler;
}
示例8: createBinding
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* Creates a Binding instance based on an EndpointDescription.
* @param ed
* @return
*/
public static Binding createBinding(EndpointDescription ed) {
if (ed == null) {
throw new NullPointerException("EndpointDescription is null");
}
String bindingType =
(ed.getServiceDescription().isServerSide()) ?
ed.getBindingType()
: ed.getClientBindingID();
if (BindingUtils.isSOAPBinding(bindingType)) {
return new SOAPBinding(ed);
}
else if (BindingUtils.isHTTPBinding(bindingType)) {
return new HTTPBinding(ed);
}
else {
// If we can't figure it out, let's default to
// a SOAPBinding
return new SOAPBinding(ed);
}
}
示例9: addHandlers
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* This code might be executed in the context of the bootstrap class loader. That's why we have to make sure we only
* call code which is visible. For example, we can't use slf4j or directly reference stagemonitor classes
*/
@Advice.OnMethodEnter
private static void addHandlers(@Advice.Argument(value = 0, readOnly = false) List<Handler> handlerChain, @Advice.This Binding binding) {
final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
final List<Handler<?>> stagemonitorHandlers = Dispatcher.get("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
if (stagemonitorHandlers != null) {
logger.fine("Adding SOAPHandlers " + stagemonitorHandlers + " to handlerChain for Binding " + binding);
if (handlerChain == null) {
handlerChain = Collections.emptyList();
}
// creating a new list as we don't know if handlerChain is immutable or not
handlerChain = new ArrayList<Handler>(handlerChain);
for (Handler<?> stagemonitorHandler : stagemonitorHandlers) {
if (!handlerChain.contains(stagemonitorHandler) &&
// makes sure we only add the handler to the correct application
Dispatcher.isVisibleToCurrentContextClassLoader(stagemonitorHandler)) {
handlerChain.add(stagemonitorHandler);
}
}
logger.fine("Handler Chain: " + handlerChain);
} else {
logger.fine("No SOAPHandlers found in Dispatcher for Binding " + binding);
}
}
示例10: setBinding
import javax.xml.ws.Binding; //导入依赖的package包/类
private void setBinding(BindingProvider client, String userName, String password) {
final Binding binding = client.getBinding();
List<Handler> handlerList = binding.getHandlerChain();
if (handlerList == null)
handlerList = new ArrayList<>();
handlerList.add(new SOAPSecurityHandler(userName, password));
binding.setHandlerChain(handlerList);
}
示例11: setup
import javax.xml.ws.Binding; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() throws APPlatformException, MalformedURLException {
besDAO.configService = confServ;
doReturn(subServ).when(besDAO).getBESWebService(
eq(SubscriptionService.class), any(ServiceInstance.class), any(Optional.class));
doReturn(idServ).when(besDAO).getBESWebService(
eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
doReturn(idServ).when(besDAO).getServicePort(eq(IdentityService.class),
anyMap());
doReturn(subServ).when(besDAO).getServicePort(
eq(SubscriptionService.class), anyMap());
Binding mockBinding = mock(Binding.class);
when(idServ.getBinding()).thenReturn(mockBinding);
}
示例12: getPort
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* this is for Client Stub Programming
*
* @param t
* @param s
* @param args
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T getPort(T t, Service s, Object[] args) {
Class<T> clz = null;
if (Class.class.isAssignableFrom(args[0].getClass())) {
clz = (Class<T>) args[0];
}
else if (Class.class.isAssignableFrom(args[1].getClass())) {
clz = (Class<T>) args[1];
}
if (clz == null) {
return t;
}
Binding binding = ((BindingProvider) t).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
final String wsdlLocation = getServiceURL(s);
T tProxy = JDKProxyInvokeUtil.newProxyInstance(clz.getClassLoader(), new Class[] { clz },
new JDKProxyInvokeHandler<T>(t, new ClientStubProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
示例13: createDispatch
import javax.xml.ws.Binding; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Dispatch createDispatch(Dispatch d, Service s, Object[] args) {
Binding binding = ((BindingProvider) d).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
final String wsdlLocation = getServiceURL(s);
Dispatch tProxy = JDKProxyInvokeUtil.newProxyInstance(this.getClass().getClassLoader(),
new Class[] { Dispatch.class },
new JDKProxyInvokeHandler<Dispatch>(d, new DispatchProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
示例14: InvoicePortType_InvoicePort_Server
import javax.xml.ws.Binding; //导入依赖的package包/类
protected InvoicePortType_InvoicePort_Server() throws java.lang.Exception {
System.out.println("Starting Server");
Object implementor = new InvoicePortImpl();
String address = "http://localhost:9000/mockInvoicePortBinding";
Endpoint ep = Endpoint.publish(address, implementor);
Binding binding = ep.getBinding();
((SOAPBinding)binding).setMTOMEnabled(true);
}
示例15: addMessageHandler
import javax.xml.ws.Binding; //导入依赖的package包/类
/**
* Add a message handler to a SOAP binding
* @param binding binding to which we'll add the handler
* @param handler the handler to be added
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void addMessageHandler(Object binding, SOAPHandler<SOAPMessageContext> handler) {
final Binding b = ((BindingProvider) binding).getBinding();
List handlerList = b.getHandlerChain();
if (handlerList == null)
handlerList = new ArrayList();
handlerList.add(handler);
b.setHandlerChain(handlerList);
}