Mr Guliarte
Mr Guliarte

Reputation: 739

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

For example: I got 3 classes in my webservice.

1 - A SEI (the interface of the Web Service):

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 implemetation 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 this address:

http://127.0.0.1:9876/calc?wsdl

I will see the WSDL of my Web Service. Now cames the question: If I can access it, it is phisically located somewhere in my computer, but...WHERE? I tried to use every Windows search engine that I know (I use Windows 8.1) and none of them is able to find it. Where is it, afterall?

Upvotes: 1

Views: 1310

Answers (1)

Plamen G
Plamen G

Reputation: 4759

In your sample the WSDL contract is generated on demand at run time, when the address is accessed. That's why you cannot find a physical WSDL file anywhere on your drive.

If you look closely at the URL, it doesn't point to a physical .wsdl file: http://127.0.0.1:9876/calc?wsdl. It is merely a query string after the question mark.

See the this tutorial if you need more information.

Upvotes: 1

Related Questions