use of com.sun.xml.ws.api.WSService in project metro-jax-ws by eclipse-ee4j.
the class ProviderImpl method getPort.
public <T> T getPort(EndpointReference endpointReference, Class<T> clazz, WebServiceFeature... webServiceFeatures) {
/*
final @NotNull MemberSubmissionEndpointReference msepr =
EndpointReferenceUtil.transform(MemberSubmissionEndpointReference.class, endpointReference);
WSService service = new WSServiceDelegate(msepr.toWSDLSource(), msepr.serviceName.name, Service.class);
*/
if (endpointReference == null)
throw new WebServiceException(ProviderApiMessages.NULL_EPR());
WSEndpointReference wsepr = new WSEndpointReference(endpointReference);
WSEndpointReference.Metadata metadata = wsepr.getMetaData();
WSService service;
if (metadata.getWsdlSource() != null)
service = (WSService) createServiceDelegate(metadata.getWsdlSource(), metadata.getServiceName(), Service.class);
else
throw new WebServiceException("WSDL metadata is missing in EPR");
return service.getPort(wsepr, clazz, webServiceFeatures);
}
use of com.sun.xml.ws.api.WSService 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;
}
use of com.sun.xml.ws.api.WSService in project metro-jax-ws by eclipse-ee4j.
the class TubelineAssemblerFactoryImplTest method getClientContext.
private ClientTubeAssemblerContext getClientContext(final BindingID bindingId, final Container container) {
final WSBinding binding = bindingId.createBinding();
final EndpointAddress address = new EndpointAddress(ADDRESS_URL);
final WSDLPort port = null;
final QName serviceName = new QName(NAMESPACE, "Service1Service");
WSService service = WSService.create(serviceName);
final QName portName = new QName(NAMESPACE, "Service1Port");
// Corresponds to Service.addPort(portName, bindingId, address)
service.addPort(portName, bindingId.toString(), ADDRESS_URL.toString());
final WSPortInfo portInfo = ((WSServiceDelegate) service).safeGetPort(portName);
WSBindingProvider wsbp = new WSBindingProvider() {
public void setOutboundHeaders(List<Header> headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setOutboundHeaders(Header... headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setOutboundHeaders(Object... headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Header> getInboundHeaders() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setAddress(String address) {
throw new UnsupportedOperationException("Not supported yet.");
}
public WSEndpointReference getWSEndpointReference() {
throw new UnsupportedOperationException("Not supported yet.");
}
public WSPortInfo getPortInfo() {
return portInfo;
}
public Map<String, Object> getRequestContext() {
throw new UnsupportedOperationException("Not supported yet.");
}
public Map<String, Object> getResponseContext() {
throw new UnsupportedOperationException("Not supported yet.");
}
public Binding getBinding() {
return binding;
}
public EndpointReference getEndpointReference() {
throw new UnsupportedOperationException("Not supported yet.");
}
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void close() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
public ManagedObjectManager getManagedObjectManager() {
return null;
}
public Set<Component> getComponents() {
throw new UnsupportedOperationException("Not supported yet.");
}
public <S> S getSPI(Class<S> type) {
throw new UnsupportedOperationException("Not supported yet.");
}
};
final ClientTubeAssemblerContext context = new ClientTubeAssemblerContext(address, port, wsbp, binding, container, ((BindingImpl) binding).createCodec(), null, null);
return context;
}
use of com.sun.xml.ws.api.WSService in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testCustomFault1.
/**
* This test tests the functionality of OnewayFeature and AddressingFeature the way it being used in WS-AT implementation
* In WS-AT impl, Server-side has to send fault messages to predefined coordinator and this test replicates that usage.
*
* @throws Exception
*/
public void testCustomFault1() throws Exception {
SOAPFault fault = SOAPFactory.newInstance().createFault("custom fault from client", SOAPConstants.SOAP_SENDER_FAULT);
WSEndpointReference to = new WSEndpointReference(getAddress(), AddressingVersion.MEMBER);
OneWayFeature owf = new OneWayFeature();
owf.setRelatesToID("uuid:foobar");
WSService service = WSService.create();
service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
Dispatch<Source> dispatch = service.createDispatch(PORT_QNAME, to, Source.class, Service.Mode.PAYLOAD, new MemberSubmissionAddressingFeature(true), owf);
// Since this fault is not a wsdl operation, we need to set SOAPAction for correct wsa:Action
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://example.com/myfault");
try {
dispatch.invokeOneWay(new DOMSource(fault));
} catch (WebServiceException e) {
// since the server-side is not provider based for this test.
// it does n't know from the fault message request that it is oneway and throws 500 code.
// so, expect a WebServcieException here.
}
}
Aggregations