use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.
the class TubelineAssemblerFactoryImplTest method testAlternateConfigFileName.
public void testAlternateConfigFileName() throws Exception {
final BindingID bindingId = BindingID.SOAP11_HTTP;
final String ALTERNATE_FILE_NAME = "tubes-config/jaxws-tubes-alternate.xml";
final Container container = new Container() {
public <S> S getSPI(Class<S> spiType) {
if (spiType.isAssignableFrom(MetroConfigName.class)) {
return spiType.cast(new MetroConfigName() {
@Override
public String getDefaultFileName() {
return ALTERNATE_FILE_NAME;
}
@Override
public String getAppFileName() {
return ALTERNATE_FILE_NAME;
}
});
} else if (spiType.isAssignableFrom(ResourceLoader.class)) {
return spiType.cast(new TestResourceLoader());
}
return null;
}
};
final ClientTubeAssemblerContext jaxwsContext = getClientContext(bindingId, container);
MetroTubelineAssembler assembler = (MetroTubelineAssembler) getAssembler(bindingId);
TubelineAssemblyController tubelineAssemblyController = assembler.getTubelineAssemblyController();
DefaultClientTubelineAssemblyContext context = new DefaultClientTubelineAssemblyContext(jaxwsContext);
Collection<TubeCreator> tubeCreators = tubelineAssemblyController.getTubeCreators(context);
assertEquals(2, tubeCreators.size());
}
use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.
the class TubelineAssemblerFactoryImplTest method testCreateDispatchClientNoConfig.
/**
* Test client creation with parameters that correspond to a dispatch client
* with no wsit-client.xml and with no WSDL.
*/
public void testCreateDispatchClientNoConfig() throws Exception {
final BindingID bindingId = BindingID.SOAP11_HTTP;
final Container container = MockupMetroConfigLoader.createMockupContainer("tubes-config/jaxws-tubes-default.xml");
final ClientTubeAssemblerContext context = getClientContext(bindingId, container);
final Tube tubeline = getAssembler(bindingId).createClient(context);
assertNotNull(tubeline);
}
use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.
the class Stub method createPipeline.
/**
* Creates a new pipeline for the given port name.
*/
private Tube createPipeline(WSPortInfo portInfo, WSBinding binding) {
// Check all required WSDL extensions are understood
checkAllWSDLExtensionsUnderstood(portInfo, binding);
SEIModel seiModel = null;
Class sei = null;
if (portInfo instanceof SEIPortInfo) {
SEIPortInfo sp = (SEIPortInfo) portInfo;
seiModel = sp.model;
sei = sp.sei;
}
BindingID bindingId = portInfo.getBindingId();
TubelineAssembler assembler = TubelineAssemblerFactory.create(Thread.currentThread().getContextClassLoader(), bindingId, owner.getContainer());
if (assembler == null) {
// TODO: i18n
throw new WebServiceException("Unable to process bindingID=" + bindingId);
}
return assembler.createClient(new ClientTubeAssemblerContext(portInfo.getEndpointAddress(), portInfo.getPort(), this, binding, owner.getContainer(), ((BindingImpl) binding).createCodec(), seiModel, sei));
}
use of com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext 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.pipe.ClientTubeAssemblerContext in project metro-jax-ws by eclipse-ee4j.
the class NonAnonymousResponseProcessor method process.
/**
* Send a response to a non-anonymous address. Also closes the transport back channel
* of {@link Packet} if it's not closed already.
*
* @param packet
* The response from our server, which will be delivered to the destination.
* @return The response packet that should be used to complete the tubeline response processing
*/
public Packet process(Packet packet) {
Fiber.CompletionCallback fiberCallback = null;
Fiber currentFiber = Fiber.getCurrentIfSet();
if (currentFiber != null) {
// Link completion of the current fiber to the new fiber that will
// deliver the async response. This allows access to the response
// packet that may be generated by sending a new message for the
// current async response.
final Fiber.CompletionCallback currentFiberCallback = currentFiber.getCompletionCallback();
if (currentFiberCallback != null) {
fiberCallback = new Fiber.CompletionCallback() {
public void onCompletion(@NotNull Packet response) {
currentFiberCallback.onCompletion(response);
}
public void onCompletion(@NotNull Throwable error) {
currentFiberCallback.onCompletion(error);
}
};
currentFiber.setCompletionCallback(null);
}
}
// we need to assemble a pipeline to talk to this endpoint.
WSEndpoint<?> endpoint = packet.endpoint;
WSBinding binding = endpoint.getBinding();
Tube transport = TransportTubeFactory.create(Thread.currentThread().getContextClassLoader(), new ClientTubeAssemblerContext(packet.endpointAddress, endpoint.getPort(), (WSService) null, binding, endpoint.getContainer(), ((BindingImpl) binding).createCodec(), null, null));
Fiber fiber = endpoint.getEngine().createFiber();
fiber.start(transport, packet, fiberCallback);
// then we'll proceed the rest like one-way.
Packet copy = packet.copy(false);
copy.endpointAddress = null;
return copy;
}
Aggregations