NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
wla2000
Joined: 07 Dec 2008 Posts: 3 Location: Royal Oak, MI
|
Posted: Sun Dec 19, 2010 12:38 am Post subject: Re: Creating Apache Axis2 Web Services on NetBeans IDE |
|
|
Jeff:
I have run into a new show-stopper. Two things are going wrong. 1) Whenever I "clean and build" a project, it wipes out the context.xml file in the build\web\META-INF folder (as well as everything else in the build folder). Then when I "run" the web application project, I get this message: "..\build\web\META-INF\context.xml (The system cannot find the file specifiedI)... BUILD FAILED".
I've have tried to work around this by copying a context.xml file from another project, and changing the path= value to the current project's context path.
2) Then when I perform a "run", the project runs, and displays the initial screen, which is index.jsp. The project is intended to consume the HelloAxisWorld web service exposed in the AxisHello project.
The index.jsp file contains a little form with a text field and a button. Clicking the button executes a servlet which attempts to consume the HelloAxisWorld service developed in your tutorial. The servlet runs but throws an exception when it invokes this line:
| Quote: | axishello.HelloAxisWorldPortType port = service.getHelloAxisWorldHttpSoap11Endpoint();
| This is the stack trace that is displayed:
| Quote: | HTTP transport error: java.net.ConnectException: Connection refused: connect
com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:133)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:153)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:93)
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
com.sun.xml.ws.client.Stub.process(Stub.java:319)
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:157)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:140)
$Proxy119.hello(Unknown Source)
servlets.TestAxisServlet.hello(TestAxisServlet.java:102)
servlets.TestAxisServlet.processRequest(TestAxisServlet.java:3
servlets.TestAxisServlet.doPost(TestAxisServlet.java:87)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
java.lang.Thread.run(Thread.java:619)
| Here is the code for the web service client servlet:
| Quote: | package servlets;
// import statements...
public class TestAxisServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter();
try {
String nameDisplay = request.getParameter("nameDisplay");
String name = hello(nameDisplay);
out.println("<html>");
out.println("<head>");
out.println("<title>Name Display</title");
out.println("</head>");
out.println("<body>");
out.println("<hr><b>Your text:</b> \"" + name + "\"" + "<p>");
out.println("</body>");
out.println("</html>");
} catch (Exception e){
StackTraceElement elems[] = e.getStackTrace();
for (StackTraceElement elem : elems){
out.println(elem);
out.println("<br>");
}
} finally {
out.close();
}
}
// HttpServlet methods are here...
private static String hello(java.lang.String name) {
axishello.HelloAxisWorld service = new axishello.HelloAxisWorld();
axishello.HelloAxisWorldPortType port = service.getHelloAxisWorldHttpSoap11Endpoint();
return port.hello(name);
}
}
|
My exception is a connection error, as if the web service refused the connection or as if the web container was not running. Of course both the client servlet and the Axis2 web service are running in the same container.
When I created the client I had to choose between Project, Local and WSDL URL. I tried to choose Project, but when I clicked the Browse button no Axis2 services were displayed. Is there any way to get Axis2 services to display? Local didn't make any sense because I think you have to specify a static WSDL file, which I don't think exists for the HelloAxisWorld service. So I chose WSDL URL and put in http://localhost:8084/axis2/services/HelloAxisWorld?wsdl, which is what was displayed in the Properties dialog when I right-clicked the HelloAxisWorld service in the AxisHello project.
Note that when I created the client Netbeans inserted the static hello() method shown above, rather than in-line code as was displayed in your tutorial. I have Netbeans 6.9.1 - is it possible that this version creates web service clients differently?
In summary, I have these questions:
1. How can I get Netbeans to create the context.xml file as mentioned above?
2. Can Axis2 web services be displayed in the Browse Web Services listing when creating a new web service client?
3. What's causing my connection exception?
4. Does Netbeans 6.9.1 create web service clients differently from earlier versions and is that OK?
Thanks. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|