Search in sources :

Example 1 with PortAddressResolver

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

the class HttpAdapter method publishWSDL.

/**
 * Sends out the WSDL (and other referenced documents)
 * in response to the GET requests to URLs like "?wsdl" or "?xsd=2".
 *
 * @param con
 *      The connection to which the data will be sent.
 *
 * @throws java.io.IOException when I/O errors happen
 */
public void publishWSDL(@NotNull WSHTTPConnection con) throws IOException {
    con.getInput().close();
    SDDocument doc = wsdls.get(con.getQueryString());
    if (doc == null) {
        writeNotFoundErrorPage(con, "Invalid Request");
        return;
    }
    con.setStatus(HttpURLConnection.HTTP_OK);
    con.setContentTypeResponseHeader("text/xml;charset=utf-8");
    OutputStream os = con.getProtocol().contains("1.1") ? con.getOutput() : new Http10OutputStream(con);
    PortAddressResolver portAddressResolver = getPortAddressResolver(con.getBaseAddress());
    DocumentAddressResolver resolver = getDocumentAddressResolver(portAddressResolver);
    doc.writeTo(portAddressResolver, resolver, os);
    os.close();
}
Also used : PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) SDDocument(com.sun.xml.ws.api.server.SDDocument) DocumentAddressResolver(com.sun.xml.ws.api.server.DocumentAddressResolver)

Example 2 with PortAddressResolver

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

the class ServerConnectionImpl method getEPRAddress.

@NotNull
public String getEPRAddress(Packet request, WSEndpoint endpoint) {
    // return WSHttpHandler.getRequestAddress(httpExchange);
    PortAddressResolver resolver = adapter.owner.createPortAddressResolver(getBaseAddress(), endpoint.getImplementationClass());
    String address = resolver.getAddressFor(endpoint.getServiceName(), endpoint.getPortName().getLocalPart());
    if (address == null)
        throw new WebServiceException(WsservletMessages.SERVLET_NO_ADDRESS_AVAILABLE(endpoint.getPortName()));
    return address;
}
Also used : PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) WebServiceException(jakarta.xml.ws.WebServiceException) NotNull(com.sun.istack.NotNull)

Example 3 with PortAddressResolver

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

the class HelidonConnectionImpl method getEPRAddress.

@Override
public String getEPRAddress(Packet request, WSEndpoint endpoint) {
    PortAddressResolver resolver = adapter.owner.createPortAddressResolver(getBaseAddress(), endpoint.getImplementationClass());
    String address = resolver.getAddressFor(endpoint.getServiceName(), endpoint.getPortName().getLocalPart());
    if (address == null) {
        throw APISupport.createException(WsservletMessages.SERVLET_NO_ADDRESS_AVAILABLE(endpoint.getPortName()));
    }
    return address;
}
Also used : PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver)

Example 4 with PortAddressResolver

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

the class HelidonAdapter method publishWSDLX.

public void publishWSDLX(WSHTTPConnection c) throws IOException {
    // res.status(Http.Status.OK_200);
    // res.headers().add("Content-Type", Collections.singletonList("text/xml;charset=utf-8"));
    // res.send();
    HelidonConnectionImpl con = (HelidonConnectionImpl) c;
    // con.getInput().close();
    SDDocument doc = wsdls.get(con.getQueryString());
    if (doc == null) {
        // writeNotFoundErrorPage(con,"Invalid Request");
        return;
    }
    // con.req.
    ServerResponse res = con.getResponse();
    res.status(Http.Status.OK_200);
    res.headers().add("Content-Type", Collections.singletonList("text/xml;charset=utf-8"));
    // res.send(con.getOutput(), OutputStream.class);
    // res.send("<s>hello</s>");
    // con.setStatus(HttpURLConnection.HTTP_OK);
    // con.setContentTypeResponseHeader("text/xml;charset=utf-8");
    // 
    // //        OutputStream os = con.getProtocol().contains("1.1") ? con.getOutput() : new Http10OutputStream(con);
    // //con.res.
    // OutputStream os = con.getOutput();
    // OutputStream os = new ByteArrayOutputStream();
    MultiFromOutputStream os = IoMulti.outputStreamMulti();
    PortAddressResolver portAddressResolver = getPortAddressResolver(con.getBaseAddress());
    DocumentAddressResolver resolver = getDocumentAddressResolver(portAddressResolver);
    res.send(os.map(byteBuffer -> DataChunk.create(false, true, byteBuffer)));
    doc.writeTo(portAddressResolver, resolver, os);
    // con.res.send(() -> {
    // });
    os.close();
}
Also used : ServerResponse(io.helidon.webserver.ServerResponse) WebModule(com.sun.xml.ws.api.server.WebModule) IoMulti(io.helidon.common.reactive.IoMulti) DataChunk(io.helidon.common.http.DataChunk) URISyntaxException(java.net.URISyntaxException) MultiFromOutputStream(io.helidon.common.reactive.MultiFromOutputStream) DocumentAddressResolver(com.sun.xml.ws.api.server.DocumentAddressResolver) IOException(java.io.IOException) SDDocument(com.sun.xml.ws.api.server.SDDocument) Logger(java.util.logging.Logger) ServerRequest(io.helidon.webserver.ServerRequest) Level(java.util.logging.Level) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint) HttpAdapterList(com.sun.xml.ws.transport.http.HttpAdapterList) PathMatcher(io.helidon.webserver.PathMatcher) PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) WSHTTPConnection(com.sun.xml.ws.transport.http.WSHTTPConnection) ServerResponse(io.helidon.webserver.ServerResponse) Packet(com.sun.xml.ws.api.message.Packet) BoundEndpoint(com.sun.xml.ws.api.server.BoundEndpoint) URI(java.net.URI) Http(io.helidon.common.http.Http) Collections(java.util.Collections) HttpAdapter(com.sun.xml.ws.transport.http.HttpAdapter) PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) MultiFromOutputStream(io.helidon.common.reactive.MultiFromOutputStream) SDDocument(com.sun.xml.ws.api.server.SDDocument) DocumentAddressResolver(com.sun.xml.ws.api.server.DocumentAddressResolver)

Example 5 with PortAddressResolver

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

the class PortableConnectionImpl method getEPRAddress.

@Override
@NotNull
public String getEPRAddress(Packet request, WSEndpoint endpoint) {
    PortAddressResolver resolver = adapter.owner.createPortAddressResolver(getBaseAddress(), endpoint.getImplementationClass());
    String address = resolver.getAddressFor(endpoint.getServiceName(), endpoint.getPortName().getLocalPart());
    if (address == null) {
        throw new WebServiceException(WsservletMessages.SERVLET_NO_ADDRESS_AVAILABLE(endpoint.getPortName()));
    }
    return address;
}
Also used : PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) WebServiceException(jakarta.xml.ws.WebServiceException) NotNull(com.sun.istack.NotNull)

Aggregations

PortAddressResolver (com.sun.xml.ws.api.server.PortAddressResolver)8 NotNull (com.sun.istack.NotNull)3 DocumentAddressResolver (com.sun.xml.ws.api.server.DocumentAddressResolver)3 SDDocument (com.sun.xml.ws.api.server.SDDocument)3 WebServiceException (jakarta.xml.ws.WebServiceException)3 WSEndpoint (com.sun.xml.ws.api.server.WSEndpoint)2 QName (javax.xml.namespace.QName)2 IndentingXMLStreamWriter (com.sun.xml.txw2.output.IndentingXMLStreamWriter)1 Packet (com.sun.xml.ws.api.message.Packet)1 BoundEndpoint (com.sun.xml.ws.api.server.BoundEndpoint)1 ServiceDefinition (com.sun.xml.ws.api.server.ServiceDefinition)1 WebModule (com.sun.xml.ws.api.server.WebModule)1 DeploymentDescriptorParser (com.sun.xml.ws.transport.http.DeploymentDescriptorParser)1 HttpAdapter (com.sun.xml.ws.transport.http.HttpAdapter)1 HttpAdapterList (com.sun.xml.ws.transport.http.HttpAdapterList)1 WSHTTPConnection (com.sun.xml.ws.transport.http.WSHTTPConnection)1 FileSystemResourceLoader (com.sun.xml.ws.transport.local.FileSystemResourceLoader)1 ByteArrayBuffer (com.sun.xml.ws.util.ByteArrayBuffer)1 DocumentLocationResolver (com.sun.xml.ws.wsdl.writer.DocumentLocationResolver)1 WSDLPatcher (com.sun.xml.ws.wsdl.writer.WSDLPatcher)1