I have a prob:
1.create a Tomcat-Project named "TomWs"
2.in WEB-INF\src create "HelloServlet.java"
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.swing.JOptionPane;
import javax.xml.ws.Endpoint;
public class HelloServlet extends HttpServlet {
public void doGet (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
Endpoint endpoint = Endpoint.publish( "http://localhost:8080/services",
new sayHello() );
res.setContentType( "text/html" );
PrintWriter out = res.getWriter();
out.println( "<html>" );
out.println( "Hallo, mein erstes
Servlet meldet sich." );
out.println( "</html>" );
out.close();
JOptionPane.showMessageDialog( null, "Server beenden" );
endpoint.stop();
}
}
"sayHello.java"
import javax.jws.soap.SOAPBinding;
import javax.jws.*;
@WebService(name="XinServ",targetNamespace="http:///")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class sayHello
{
@WebMethod
public
String hello( String name )
{
return "Hello " + name + "!";
}
@WebMethod(operationName="body-mass-index")
@WebResult(name = "your-bmi")
public double bmi( @WebParam(name="height") double height,
@WebParam(name="weight") double weight )
{
return weight / (height * height) / 100 * 100;
}
}
3. compile the tow classes in Web-Inf\classes
4. create web.xml in WEB-INF\web.xml
<!DOCTYPE web-app PUBLIC
'-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
5. start Tomcat-server in eclipse
6. (Problem)
-- input the "http://localhost:8080/TomWs/hello" --> nothing in the
browser, but there are small dialog "server beenden"
-- input the "http:localhost:8080/services?wsdl" --> nothing and nothing
Why??? How can i see my WSDL-file?
please help me!!!