What is the endpoint address of my web service deployed on Tomcat? - java

I am working with some code I didn't write. It is a web server deployed in Tomcat. I finally got the server up and running, but now I can't figure out what endpoint to call to get a response. Where can I find this info?
I know tomcat is running on port 9090 from inspecting the server in eclipse.
Here is the seemingly relevant portion of my sun-jaxws.xml
<endpoint name="DMS"
implementation="<path to class that implements the service>"
url-pattern="/services/ExternalDocumentService">
Here is part of my web.xml
<servlet-mapping>
<servlet-name>WebServiceServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
Here is a screenshot of the server info in eclipse
I already imported the WSDL into SoapUi, but I need to know what address to enter to actually reach my endpoint. Where can I find that address?

Related

Why I am getting 404 error while hiding .jsp extension in web.xml file?

I configured all my JSP page in web.xml file to hide .jsp extension and I created custom URL in web.xml file corresponding to each JSP page due to SEO point of view but when I deployed this application at server tomcat which is running under Apache web server so my server team replies me like this but I am not getting what does they mean.
Please note that you are running in a server where apache is the web
server and Tomcat is a servlet container. This way all static requests
such as images, CSS, js, HTML are handled by apache and jsp, servlets
are handled by Tomcat. This means Apache will forward any request that
you send with the following extension to tomcat
.jsp
/servlet
.do
This means in order for Tomcat to execute your code you need to send a
request to apache as .jsp, /servlet and .do. Once you send this way,
it will automatically send to tomcat to running there. In your case
/hosting will be executed by apache only and that's why you get this
error of 404.
web.xml
<servlet>
<servlet-name>domain</servlet-name>
<jsp-file>/domain-registration.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>domain</servlet-name>
<url-pattern>/domain-registration</url-pattern>
</servlet-mapping>
Do give the proper error, on which url you are getting 404?
Try any other url-pattern you have already specified in the web.xml, check if it works properly or not. I think there is some syntax mistake in your web.xml file other wise it should work.

Servlet Working fine on local Server, but Unable to Invoke Same Servlet on Real cpanel Live Server

I am working with the Java Web Application Where user Should Invoke a servlet with the Url like
(This works fine when i run my project on my local server, Login is a Java Class extends HttpServlet).
But When i upload my project to Live Server through FileZilla FTP client
i am unable to invoke the Servlet with the Url like
www.mydomain.com/myproj/Login(Server returning Error 404)
Please see my Images and please kindly help me..
Thank you in advance..
Project Structure
web.xml for Live Server
I found the mistake..
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/servlet/Login</url-pattern>
</servlet-mapping>
if i map my servlet as above it is working.. but the another problem i am facing is, i am unable to invoke a servlet if i dont use "servlet" in my url mapping.. which obviously tells to the user what technology i am using.. how can i use my servlet without mentioning servlet in url pattern

Tomcat - Click on Web Service gets "The requested resource is not available"

I am newbie for Java web services and tomcat.
I didn't find a specific answer, so I am trying...
I have built a war to deploy on a tomcat 8.0.28 server on windows (and later on Solaris)
On the "Tomcat Web Application Manager" I can see my webapp listed among the applications list and I see that it's "running" status is "true". (see image)
Doesn't it mean that the service is up and running?
I have two problems, which probably relate:
When I click on the application link on the Tomcat Web Application Manager, it gives me 404 error. Is it logical? Why is that?
On the WAR project I have a main method, in which I create a file. I can't find it, so I assume, it was never called. I guess it relates to the previous matter...
My suspicion is that I didn't configure the address well somewhere. I will try to pass here all the data that I think is relevant:
The application path, as it is shown in the "Tomcat Web Application Manager" is /CcgwServerWsCxf.
The display name as it is shown in the "Tomcat Web Application Manager" is CcgwCallbackWsServerWAR.
The servlet part in web.xml is as follows:
<servlet>
<servlet-name>CcgwCallbackServlet</servlet-name>
<servlet-class>com.mycomp.ta.load.CcgwCallbackServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CcgwCallbackServlet</servlet-name>
<url-pattern>/CCGWCallback/*</url-pattern>
</servlet-mapping>
This is my code in the port server class constructor:
System.out.println("Starting Server");
Object implementor = new CCGWCallbackPortTypeImpl();
String address = "http://192.168.5.106:1234/CCGWCallback/CallbackServer";
Endpoint.publish(address, implementor);
(1234 is my tomcat port)
The service address that I send to the client so it can send my notification messages back is:
http://192.168.5.106:1234/CCGWCallback/CallbackServer
The Serivce QName is
new QName("http://teleconference.mycompany.com/CCGW", "CCGWService");
I hope that I gave all the data.
Can you please help?
Thank you.
The context path of your application is /CcgwServerWsCxf and your servlet is mapped to /CCGWCallback/* (relative to the context path).
Any request with path below /CcgwServerWsCx is routed to your application.
But only requests with a path below /CcgwServerWsCx/CCGWCallback hit your servlet.
Therefore Tomcat responds with a 404 when you call /CcgwServerWsCxf (e.g. the hyperlink in the manager app).
You should call /CcgwServerWsCx/CCGWCallback and verify that your servlet is invoked.
Also you need to make sure that any client also uses the correct paths. For instance the URL http://192.168.5.106:1234/CCGWCallback/CallbackServer should probably be http://192.168.5.106:1234/CcgwServerWsCx/CCGWCallback/CallbackServer given your current Tomcat config.

403 Forbidden Error on Tomcat 7 When using POST or PUT

I have an AngularJS front end that receives data from a Java web service. Both of these live on a Tomcat 7 server. My application performs GET operations correctly. However, when I am trying to save a new object or update an object, my POST and PUT operations return a 403 Forbidden error.
From searching around, I found that Tomcat has PUT disabled and that it has to be turned on. So I modified the web.xml file in the conf folder in the Tomcat directory and added the following code under the DefaultServlet:
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
After this, the server was restarted. But I am still receiving the 403 error.
Please let me know what other information I can include to help find what I am doing wrong.
The answer to my issue was discovered this morning. This was not a tomcat configuration error. Rather it was an authentication issue. We use openam to authenticate on the servers and the PUT and POST options were not marked. Once those were checked, my web services worked correctly.

Deploy web service on Tomcat with OpenEJB

I need to deploy web service on Tomcat with installed OpenEJB.
I compiled simple Hello service that just prints "Hello" with JAX-WS and tried to deploy on tomcat, but got errors while deployment :
ERROR - Error deploying CXF webservice for servlet helloservice.endpoint.Hello
java.lang.IllegalArgumentException: Could not find servlet helloservice in web application context /helloservice
Please, help what is done wrong here.
Is tomcat + openejb is sufficient for web service deployment?
Thanks.
For others who might be looking to do web services with Tomcat/OpenEJB, here's a simple example that uses an transactional EJB web service to add/list/delete records with JPA:
https://svn.apache.org/repos/asf/openejb/tags/openejb-3.1.2/examples/webapps/moviefun/
The example also includes a Perl SOAP::Lite client that can read/write to the web service.
Please, help what is done wrong here.
Is tomcat + openejb is sufficient for
web service deployment?
A servlet/JSP engine is sufficient for web development. You don't need OpenEJB for that.
"Service" is a loaded term. Do you mean "SOAP web service"? Or "EJB stateless session bean"?
Check your web.xml. Sounds like you failed to declare a servlet named helloservice. It ought to look like this:
<servlet>
<servlet-name>helloservlet</servlet-name>
<servlet-class>com.your.package.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloservlet</servlet-name> <!-- names must match -->
<url-pattern>*.html</url-pattern>
</servlet-mapping>

Categories