When I use an "Endpoint" class to publish a Web Service, where is the WSDL created?

2

For example, I have 3 classes in my Web Service:

1 - An SEI (the Web Service Interface):

package calc;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.RPC)
public interface CalculatorServer {
    @WebMethod float sum(float num1, float num2);
    @WebMethod float subtraction(float num1, float num2);
    @WebMethod float multiplication(float num1, float num2);
    @WebMethod float division(float num1, float num2);
}

2 - A SIB (the implementation of the Interface):

package calc;

import java.util.Date;
import javax.jws.WebService;

@WebService(endpointInterface = "calc.CalculatorServer")
public class CalculatorServerImpl implements CalculadoraServer {

    public float sum(float num1, float num2) {
        return num1 + num2;
    }

    public float subtraction(float num1, float num2) {
        return num1 - num2;
    }

...

}

3 - And the class responsible for publishing it:

package calc;

import javax.xml.ws.Endpoint;

public class CalculadoraServerPublisher {

    public static void main(String[] args)
    {
        Endpoint.publish("http://127.0.0.1:9876/calc",
        new CalculadoraServerImpl());
    }
}

If I run the third class and access the address:

http://127.0.0.1:9876/calc?wsdl

I will see the WSDL of my Web Service. Hence the question: if I can access it, it is physically allocated somewhere on my computer, but ... WHERE? I tried to use all the Windows search tools I know (I use Windows 8.1) and none of them could find it. Where is he, anyway?

    
asked by anonymous 21.04.2015 / 18:48

1 answer

0
  

Here's the question: if I can access it, it's physically allocated somewhere on my computer, but ... WHERE?

It is not true that if you are accessing some feature it necessarily needs to be physical and be somewhere on the computer. The case presented by you is one of these scenarios, since the WSDL is storing in memory (not WSDL exactly, but what form it).

With JAX-RS, if we do not inform the location of the WSDL it is generated automatically. In the JAX-WS specification (considering 2.2), we have the following in 5.2.2 Publicação :

  

The WSDL contract for an endpoint is dynamically created based on the annotations on the implementor   class, the Binding in use and the set of metadata documents specified in the endpoint (see 5.2.4)

In other words, WSDL is created dynamically and annotation-based endpoint metadata is created. However in the specification there is nothing that tells HOW these artifacts should be stored.

Each implementation of the specification stores WSDL in a way, so to know details of WHERE is stored, it is necessary to see how each implementation accomplishes this task, but since one already has the metadata it is common that it is in memory on some object and is serialized whenever the URLs ending in ?wsdl or ?WSDL are called.

You can look in detail at the JAX-WS specification available at link , the 5.2.4 and 5.2.5 have relevant information, as well as documentation of JAX-WS implementations that meet these points of the specification, such as looking at the classes of packages com.sun.xml.internal.ws.transport and com.sun.xml.internal.ws.wsdl , from JDK, to see how references are stored for serialization.

    
21.04.2015 / 21:45