use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class WSServiceDelegate method createDispatch.
public <T> Dispatch<T> createDispatch(QName portName, WSEndpointReference wsepr, Class<T> aClass, Service.Mode mode, WebServiceFeatureList features) {
PortInfo port = safeGetPort(portName);
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
BindingImpl binding = port.createBinding(features, null, null);
binding.setMode(mode);
Dispatch<T> dispatch = Stubs.createDispatch(port, this, binding, aClass, mode, wsepr);
serviceInterceptor.postCreateDispatch((WSBindingProvider) dispatch);
return dispatch;
}
use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class WSServiceDelegate method getPort.
protected <T> T getPort(WSEndpointReference wsepr, QName portName, Class<T> portInterface, WebServiceFeatureList features) {
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
SEIPortInfo spi = addSEI(portName, portInterface, features);
return createEndpointIFBaseProxy(wsepr, portName, portInterface, features, spi);
}
use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class WSServiceDelegate method createDispatch.
protected Dispatch<Object> createDispatch(QName portName, WSEndpointReference wsepr, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeatureList features) {
PortInfo port = safeGetPort(portName);
ComponentFeature cf = features.get(ComponentFeature.class);
if (cf != null && !Target.STUB.equals(cf.getTarget())) {
throw new IllegalArgumentException();
}
ComponentsFeature csf = features.get(ComponentsFeature.class);
if (csf != null) {
for (ComponentFeature cfi : csf.getComponentFeatures()) {
if (!Target.STUB.equals(cfi.getTarget()))
throw new IllegalArgumentException();
}
}
features.addAll(this.features);
BindingImpl binding = port.createBinding(features, null, null);
binding.setMode(mode);
Dispatch<Object> dispatch = Stubs.createJAXBDispatch(port, binding, jaxbContext, mode, wsepr);
serviceInterceptor.postCreateDispatch((WSBindingProvider) dispatch);
return dispatch;
}
use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class SDODatabindingTestBase method invmSetup.
protected WebServiceFeature[] invmSetup(final URL wsdlURL, final Class sei, final Class seb, final QName serviceName, final QName portName) {
DatabindingModeFeature dbmf = new DatabindingModeFeature("eclipselink.sdo");
Class implementorClass = seb;
boolean handlersSetInDD = false;
Container container = Container.NONE;
Map<String, SDDocumentSource> docs = new HashMap<String, SDDocumentSource>();
SDDocumentSource primaryWSDL = SDDocumentSource.create(wsdlURL);
docs.put(wsdlURL.toString(), primaryWSDL);
ExternalMetadataFeature exm = ExternalMetadataFeature.builder().setReader(new com.sun.xml.ws.model.ReflectAnnotationReader() {
public <A extends Annotation> A getAnnotation(final Class<A> annType, final Class<?> cls) {
if (WebService.class.equals(annType)) {
final WebService ws = cls.getAnnotation(WebService.class);
return (A) new jakarta.jws.WebService() {
public Class<? extends Annotation> annotationType() {
return WebService.class;
}
@Override
public String endpointInterface() {
return sei.getName();
}
@Override
public String name() {
return (ws != null) ? ws.name() : null;
}
@Override
public String portName() {
return (ws != null) ? ws.portName() : null;
}
@Override
public String serviceName() {
return (ws != null) ? ws.serviceName() : null;
}
@Override
public String targetNamespace() {
return (ws != null) ? ws.targetNamespace() : null;
}
@Override
public String wsdlLocation() {
return (ws != null) ? ws.wsdlLocation() : null;
}
};
}
return cls.getAnnotation(annType);
}
}).build();
BindingID bindingID = BindingID.parse(implementorClass);
WSBinding binding = bindingID.createBinding(dbmf, exm);
final WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass, !handlersSetInDD, null, serviceName, portName, container, binding, primaryWSDL, docs.values(), XmlUtil.createEntityResolver(null), false);
ComponentFeature cf = new ComponentFeature(new com.sun.xml.ws.api.Component() {
public <S> S getSPI(Class<S> spiType) {
if (TransportTubeFactory.class.equals(spiType))
return (S) new TransportTubeFactory() {
public Tube doCreate(ClientTubeAssemblerContext context) {
return new InVmTransportTube(context.getCodec(), context.getBinding(), wsdlURL, endpoint);
}
};
return null;
}
});
WebServiceFeature[] f = { dbmf, cf };
return f;
}
use of com.sun.xml.ws.api.ComponentFeature in project metro-jax-ws by eclipse-ee4j.
the class ClientProxyTest method testNullResponseFromTube.
@SuppressWarnings("unchecked")
public void testNullResponseFromTube() throws Exception {
URL wsdlURL = Thread.currentThread().getContextClassLoader().getResource("etc/EchoService.wsdl");
EchoService srv = new EchoService(wsdlURL, new ComponentFeature(new com.sun.xml.ws.api.Component() {
public <S> S getSPI(Class<S> spiType) {
if (TransportTubeFactory.class.equals(spiType))
return (S) new TransportTubeFactory() {
public Tube doCreate(ClientTubeAssemblerContext context) {
return new EchoTube();
}
};
if (TubelineAssemblerFactory.class.equals(spiType))
return (S) new TubelineAssemblerFactory() {
public TubelineAssembler doCreate(BindingID bindingId) {
return new TubelineAssembler() {
public Tube createClient(ClientTubeAssemblerContext context) {
final Tube head = context.createTransportTube();
return new EchoTube() {
public NextAction processRequest(Packet request) {
NextAction na = new NextAction();
na.invoke(head, request);
return na;
}
public NextAction processResponse(Packet response) {
NextAction na = new NextAction();
na.returnWith(new Packet());
return na;
}
};
}
public Tube createServer(ServerTubeAssemblerContext context) {
return null;
}
};
}
};
return null;
}
}));
Echo echo = srv.getEchoPort();
try {
int res = echo.add(new NumbersRequest());
fail();
} catch (Exception e) {
assertFalse(e instanceof NullPointerException);
assertTrue(e instanceof WebServiceException);
}
try {
echo.echoString(new Holder(wsdlURL.toString()));
fail();
} catch (Exception e) {
assertFalse(e instanceof NullPointerException);
assertTrue(e instanceof WebServiceException);
}
}
Aggregations