Search in sources :

Example 1 with Component

use of com.sun.xml.ws.api.Component in project metro-jax-ws by eclipse-ee4j.

the class HttpAdapter method handleGet.

public boolean handleGet(@NotNull WSHTTPConnection connection) throws IOException {
    if (connection.getRequestMethod().equals("GET")) {
        // metadata query. let the interceptor run
        for (Component c : endpoint.getComponents()) {
            HttpMetadataPublisher spi = c.getSPI(HttpMetadataPublisher.class);
            if (spi != null && spi.handleMetadataRequest(this, connection)) {
                return true;
            }
        // handled
        }
        if (isMetadataQuery(connection.getQueryString())) {
            // Sends published WSDL and schema documents as the default action.
            publishWSDL(connection);
            return true;
        }
        Binding binding = getEndpoint().getBinding();
        if (!(binding instanceof HTTPBinding)) {
            // Writes HTML page with all the endpoint descriptions
            writeWebServicesHtmlPage(connection);
            return true;
        }
    } else if (connection.getRequestMethod().equals("HEAD")) {
        connection.getInput().close();
        Binding binding = getEndpoint().getBinding();
        if (isMetadataQuery(connection.getQueryString())) {
            SDDocument doc = wsdls.get(connection.getQueryString());
            connection.setStatus(doc != null ? HttpURLConnection.HTTP_OK : HttpURLConnection.HTTP_NOT_FOUND);
            connection.getOutput().close();
            connection.close();
            return true;
        } else if (!(binding instanceof HTTPBinding)) {
            connection.setStatus(HttpURLConnection.HTTP_NOT_FOUND);
            connection.getOutput().close();
            connection.close();
            return true;
        }
    // Let the endpoint handle for HTTPBinding
    }
    return false;
}
Also used : Binding(jakarta.xml.ws.Binding) HTTPBinding(jakarta.xml.ws.http.HTTPBinding) SDDocument(com.sun.xml.ws.api.server.SDDocument) Component(com.sun.xml.ws.api.Component) HTTPBinding(jakarta.xml.ws.http.HTTPBinding)

Example 2 with Component

use of com.sun.xml.ws.api.Component 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;
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) QName(javax.xml.namespace.QName) WSService(com.sun.xml.ws.api.WSService) WSPortInfo(com.sun.xml.ws.api.client.WSPortInfo) WSDLPort(com.sun.xml.ws.api.model.wsdl.WSDLPort) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference) Header(com.sun.xml.ws.api.message.Header) WSServiceDelegate(com.sun.xml.ws.client.WSServiceDelegate) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) List(java.util.List) Component(com.sun.xml.ws.api.Component) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext) EndpointAddress(com.sun.xml.ws.api.EndpointAddress)

Example 3 with Component

use of com.sun.xml.ws.api.Component in project metro-jax-ws by eclipse-ee4j.

the class TubelineAssemblerFactoryImplTest method testDispatch.

/**
 * Execute a sequence that corresponds to:
 * <pre>
 *   Service.createService(null, serviceName);
 *   Service.addPort(portName, bindingId, address);
 * </pre>
 */
private Tube testDispatch(String configFileName) throws PolicyException {
    final URL wsdlLocation = null;
    final QName serviceName = new QName(NAMESPACE, "Service1Service");
    // Corresponds to Service.createService(wsdlLocation, serviceName)
    final WSServiceDelegate serviceDelegate = new WSServiceDelegate(wsdlLocation, serviceName, Service.class);
    final QName portName = new QName(NAMESPACE, "Service1Port");
    final BindingID bindingId = BindingID.SOAP11_HTTP;
    // Corresponds to Service.addPort(portName, bindingId, address)
    serviceDelegate.addPort(portName, bindingId.toString(), ADDRESS_URL.toString());
    final EndpointAddress address = new EndpointAddress(ADDRESS_URL);
    final WSDLPort port = null;
    final WSPortInfo portInfo = serviceDelegate.safeGetPort(portName);
    final WSBinding binding = bindingId.createBinding(new AddressingFeature(true));
    final Container container = MockupMetroConfigLoader.createMockupContainer("tubes-config/" + configFileName);
    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 getAssembler(bindingId).createClient(context);
}
Also used : WSBinding(com.sun.xml.ws.api.WSBinding) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) BindingID(com.sun.xml.ws.api.BindingID) URL(java.net.URL) WSPortInfo(com.sun.xml.ws.api.client.WSPortInfo) WSDLPort(com.sun.xml.ws.api.model.wsdl.WSDLPort) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) EndpointReference(jakarta.xml.ws.EndpointReference) Container(com.sun.xml.ws.api.server.Container) Header(com.sun.xml.ws.api.message.Header) WSServiceDelegate(com.sun.xml.ws.client.WSServiceDelegate) WSBindingProvider(com.sun.xml.ws.developer.WSBindingProvider) List(java.util.List) Component(com.sun.xml.ws.api.Component) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext) EndpointAddress(com.sun.xml.ws.api.EndpointAddress)

Aggregations

Component (com.sun.xml.ws.api.Component)3 EndpointAddress (com.sun.xml.ws.api.EndpointAddress)2 WSBinding (com.sun.xml.ws.api.WSBinding)2 WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)2 WSPortInfo (com.sun.xml.ws.api.client.WSPortInfo)2 Header (com.sun.xml.ws.api.message.Header)2 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)2 ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)2 WSServiceDelegate (com.sun.xml.ws.client.WSServiceDelegate)2 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)2 EndpointReference (jakarta.xml.ws.EndpointReference)2 List (java.util.List)2 QName (javax.xml.namespace.QName)2 BindingID (com.sun.xml.ws.api.BindingID)1 WSService (com.sun.xml.ws.api.WSService)1 Container (com.sun.xml.ws.api.server.Container)1 SDDocument (com.sun.xml.ws.api.server.SDDocument)1 Binding (jakarta.xml.ws.Binding)1 HTTPBinding (jakarta.xml.ws.http.HTTPBinding)1 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)1