Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing a WS with Jax-WS Endpoint

Tags:

I built a minimal web service and published it using javax.xml.ws.Endpoint. If I try to get the WSDL at http://localhost:1234/AddService?wsdl it works fine.

Trying to recieve it at http://192.168.0.133:1234/AddService?wsdl, I don't receive anything. This address is the same as localhost.

Is there a posibiility to publish a webservice without providing the address?

package test;  import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.ws.Endpoint;  @WebService public class AddService {      @WebMethod     public int add(int a, int b){         return a+b;     }      public static void main(String[] args ){         Endpoint.publish("http://localhost:1234/AddService", new AddService());     } } 

Changing the code to

Endpoint.publish("http://192.168.0.133:1234/AddService", new AddService()); 

gets me the wsdl on the IP address but not on localhost.

Isn't there a posibility to just define the port?

like image 690
daniel Avatar asked Sep 09 '10 21:09

daniel


People also ask

What is Endpoint publishing web service?

Endpoint publish() method to specify the server context, or the address and optionally the implementor of the Web Service endpoint. Note: If you wish to update the metadata documents (WSDL or XML schema) associated with the endpoint, you must do so before publishing the endpoint.


1 Answers

Could you try publishing it on 0.0.0.0?

like image 73
ivy Avatar answered Oct 15 '22 20:10

ivy