Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to see WSDL after hitting the URL ending with ?wsdl for my sample web service.  RSS feed

 
Monica Shiralkar
Ranch Hand
Posts: 914
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I create a soap based sample web service. Class name is MyImpl. The name of web service is MyWebservice. Now using eclipse I did the steps to right click on this class and create web service. I copied the WSDL to a location on my local. I opened the web logic console and under deployments clicked on browse button to deploy and selected the location of this wsdl. On finishing with these steps. I went to browser and hit the below URL:


http://localhost/7001/MyImpl/MyWebservice?wsdl

On hitting this URL I did not get the WSDL file but instead got error message saying not found. Please advice whether any of these steps are wrong?

thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That URL looks incorrect. Does the servlet container really run on port 80, and the web app is called "7001"? Or was that just a copy/paste mistake when you wrote this post?

Also, WS are not generally accessible under their class name, just like servlets aren't. There's generally a common prefix (like "services") that is configured in the web.xml.

Which SOAP stack are you using?

How did you deploy the WS on WebLogic? I'm having a hard time seeing how "I opened the web logic console and under deployments clicked on browse button to deploy and selected the location of this wsdl." by itself would do that.
 
Monica Shiralkar
Ranch Hand
Posts: 914
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That URL looks incorrect. Does the servlet container really run on port 80, and the web app is called "7001"? Or was that just a copy/paste mistake when you wrote this post?


Yes.there is a typing mistake in URL .The actual URL is :

http://localhost:7001/MyImpl/MyWebservice?wsdl




I tried a new example now by using some simpler names like HelloWorld and the URL now would be

http://localhost:7001/HelloWorld/HelloWorld?wsdl


7001 is the port on which oracle web logic server is running.

Also, WS are not generally accessible under their class name, just like servlets aren't. There's generally a common prefix (like "services") that is configured in the web.xml.

Which SOAP stack are you using?

How did you deploy the WS on WebLogic? I'm having a hard time seeing how "I opened the web logic console and under deployments clicked on browse button to deploy and selected the location of this wsdl." by itself would do that.



I tried this example again by taking some simple names like Hello World.All I did was:

1. Create a HelloWorld class.




2. I right clicked on this class in Eclipse and clicked on create web service. WSDL was created.


3. Now I create WAR using eclipse by doing eclipse File export to a WAR option.

4. Now I opened weblogic console at https: //localhost:7001/Console
I entered username password.

5. I clicked on deployments on left side of page.

6. Clicked on next and it gave option to browse for war. I selected by war.

7. I continued with steps to finish.

8. Deployment complete . Now I tried to access my WSDL at below location on a new browser:

http://localhost:7001/HelloWorld/HelloWorld?wsdl



Instead of wsdl, i see and error message saying cannot be found.

Please advice where am I going wrong?

thanks
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the wsdl content look like (the one which Eclipse created)? Also what is the context name of the deployed web application? Please also post the exact error message you are seeing.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couple of changes are required but before that , avoid creating WAR file using Eclipse. It is always better to create WAR file either by using any Build script (Ant), project management tool (Maven ) or with basic jar utility of Java. That way, you shall be able to control your code and dependencies properly
Now coming to your issue, problem is that you have defined your SIB class (with @WebService) and package it in WAR file. But you have not told Servlet container (in your case WebLogic Servlet Container) runtime to detect or find Web Service definition (HelloWorld class) and deploy it as WebService for you.
Between Step 1 and 2, you need to add below mentioned steps

  • Create a sun-jaxws.xml, defines web service implementation class.
    Create a standard web.xml, defines WSServletContextListener, WSServlet and structure of a web project.


  • So define sun-jaxws.xml file and add WSServletContextListener and WSServlet details in your web app.
     
    Ulf Dittmer
    Rancher
    Posts: 42972
    73
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    In addition to what Abhay said, I still think it's unlikely that the WS (and thus its WSDL) would be accessible under the URL .../MyImpl or .../HelloWorld. How is the WSServlet (or whatever is appropriate for your SOAP implementation) configured in web.xml? Are you sure it's not listening to some URL subspace like ".../service/..." or some such?
     
    Frits Walraven
    Creator of Enthuware JWS+ V6
    Saloon Keeper
    Posts: 2966
    210
    Android Chrome Eclipse IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If your application server is EE6 compliant you might not even need any of the configuration files.

    Glassfish for instance will detect that there is a @WebService annotation inside a web module (war file) and will create the Web Service without the need of any specific configuration files. The JAX-WS runtime in this case will create the wrapper Servlet by using the new Servlet 3.0 feature (Servlet 3.0, Chapter 4 programmatically adding and configuring Servlets, programmatically adding and configuring Listeners)

    Regards,
    Frits
     
    Monica Shiralkar
    Ranch Hand
    Posts: 914
    2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks all.

    I had previously run this example successfully using Eclipse on tomcat server but doing the steps: right click on class >> create web service>>. Right click on project >> run on server .After this the web service got hosted on tomcat server and I could access the WSDL.

    However I faced issues by trying the same on weblogic and using the server independently of Eclipse.,

    How to make the second approach work just like the first approach.

    thanks
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!