I have started learning webservices development using Axis2.
We need to follow the contract first approach. I have created this simple WSDL.
Using this WSDL I need to write the webservice. Can someone please let me know how can I generate the classes from this WSDL. Is there a tool/command available to do so? Once the classes are generated I can write my businesslogic in them and then expose the service to the clients.
Thank you
This message was edited 1 time. Last update was at by Anjali S Sharma
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
The binding names which you are using in your service are not defined. Modify it as follows.
but it says
"This will generate only those bindings necessary for the client.".
But I need to generate the classes for creating the service. Is this even the right approach to creating webservices, that is, first write the wsdl, then generate the webservice classes and then put your business logic in those classes?
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
Top down (wsdl first/ contract first) or bottom up (code first) depends on the requirement. Suppose you have same existing code and want to expose as webservice then you would go for code first but if you are developing from scratch then contract first can be a good approach. Developer would like to do code first while business analyst would like to have contract first. There are lot of discussion you can find on net.
Regarding generation of classes, see the "Implementation Template Description" heading in the axis tutorial link you have mentioned. Here it generates template implementation where you can write your business logic.
This message was edited 1 time. Last update was at by Anjali S Sharma
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
Welcome :-)
It's document literal style wsdl so it doesn't expect more than one part in message according to ws basic profile. Lets modify wsdl as follows
This should work.
If you want to retain everything then create complex types say, EmpDetails and Emp. Wrap EmpDetails and EmpName in Emp complex type and refer it in wsdl:message.
Anjali S Sharma
Ranch Hand
Joined: Jun 29, 2005
Posts: 279
posted
0
Thanks a lot.
Now I am getting the following
But "c:\temp" is a valid directory in my system. So can't make out why this error.
This is my updated WSDL
Thank you
This message was edited 1 time. Last update was at by Anjali S Sharma
This message was edited 1 time. Last update was at by shivendra tripathi
Anjali S Sharma
Ranch Hand
Joined: Jun 29, 2005
Posts: 279
posted
0
Still getting the same error.
Here is the updated wsdl
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
I guess the output location is not a folder. Can you provide complete detail of all the steps you are following to generate classes. So that I can try and debug it?
c:\temp and c:\temp\src are valid directories. Which root directory is the error pointing to?
Thank you
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
I tried following and it's worked. A peace of advice don't try all the available option first time rather try one by one. This way you can figure out where is the problem.
C:\MyFolder\MySoftwareLab\tools\axis2-1.5.1-bin\axis2-1.5.1\bin>wsdl2java.bat -s
s -sd -g -ssi -uri C:\MyFolder\MySoftwareLab\Test.wsdl
This message was edited 2 times. Last update was at by shivendra tripathi
Anjali S Sharma
Ranch Hand
Joined: Jun 29, 2005
Posts: 279
posted
0
shivendra tripathi wrote:I tried following and it's worked. A peace of advice don't try all the available option first time rather try one by one. This way you can figure out where is the problem.
C:\MyFolder\MySoftwareLab\tools\axis2-1.5.1-bin\axis2-1.5.1\bin>wsdl2java.bat -s
s -sd -g -ssi -uri C:\MyFolder\MySoftwareLab\Test.wsdl
Thanks a lot. It worked. I was able to generate with Eclipse.
Thanks for the help.
Sunil swain
Greenhorn
Joined: Jul 14, 2009
Posts: 10
posted
0
Hi, I am using java,tomcat 5.5 ,Axis2 and eclipse. I created .aar file in deployment directory while going through top down approach.After that when i typed "http://localhost:8080/axis2/" i got the exception as "org.apache.jasper.JasperException" pointing root cause as "java.lang.NullPointerException".Any one can give the pointer for the solution? Thanks in adv.
shivendra tripathi
Ranch Hand
Joined: Aug 26, 2008
Posts: 263
posted
0
Can you post your WSDL, stack trace and steps you followed?
Sunil swain
Greenhorn
Joined: Jul 14, 2009
Posts: 10
posted
0
Sorry actually i was using bottom up approach.
The stack trace is:
exception:
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
org.apache.jsp.axis2_002dweb.index_jsp._jspService(index_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Thanks for the response. Actually i got the solution by changing the axis2.war file.
Kevin Eddy
Ranch Hand
Joined: Feb 24, 2010
Posts: 74
posted
0
Sunil swain wrote:Thanks for the response. Actually i got the solution by changing the axis2.war file.
I'm curious, what do you mean by "changing the axis2.war file"?
Sunil swain
Greenhorn
Joined: Jul 14, 2009
Posts: 10
posted
0
Initially i took the zip file of axis2.But when i downloaded axis2.war,it worked with that.Actually in the unzip version of downloaded asix2 there was no services directory under WEB-INF.