Axis2 - WSDL to code
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
posted 15 years ago
The binding names which you are using in your service are not defined. Modify it as follows.
There are couple of tools which you can use to validate WSDL. One of them is mentioned in link below
http://charithaka.blogspot.com/2008/07/how-to-validate-wsdl-using-eclipse.html
And regarding generating classes axis provide utility wsdltojava which you can use to generate classes.
-Shiv
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The binding names which you are using in your service are not defined. Modify it as follows.
There are couple of tools which you can use to validate WSDL. One of them is mentioned in link below
http://charithaka.blogspot.com/2008/07/how-to-validate-wsdl-using-eclipse.html
And regarding generating classes axis provide utility wsdltojava which you can use to generate classes.
-Shiv
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks a lot for replying.
I went through wsdl2java
http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
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?
I went through wsdl2java
http://ws.apache.org/axis/java/user-guide.html#UsingWSDLWithAxis
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
Posts: 263
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
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.
SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks a lot.
I tried doing the following
C:\axis2-1.5.1\samples\quickstart\build>C:\axis2-1.5.1\bin\wsdl2java.bat -o c:\t
emp -ss -sd -g -S c:\temp\src -uri ResumeService.wsdl
but it gave me the following error
Can you please let me know how to resolve this?
This is my updated wsdl
Thank you
I tried doing the following
C:\axis2-1.5.1\samples\quickstart\build>C:\axis2-1.5.1\bin\wsdl2java.bat -o c:\t
emp -ss -sd -g -S c:\temp\src -uri ResumeService.wsdl
but it gave me the following error
Can you please let me know how to resolve this?
This is my updated wsdl
Thank you
shivendra tripathi
Ranch Hand
Posts: 263
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
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.
SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
shivendra tripathi
Ranch Hand
Posts: 263
posted 15 years ago
first of all modify employee as follows
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="ns:employeeName" />
<xs:element minOccurs="0" ref="ns:employeeDetails" />
</xs:sequence>
</xs:complexType>
</xs:element>
In case it's still not working I can be reached at [email protected]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
first of all modify employee as follows
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="ns:employeeName" />
<xs:element minOccurs="0" ref="ns:employeeDetails" />
</xs:sequence>
</xs:complexType>
</xs:element>
In case it's still not working I can be reached at [email protected]
SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Still getting the same error.
Here is the updated wsdl
Here is the updated wsdl
shivendra tripathi
Ranch Hand
Posts: 263
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I am executing the following from command line
C:\axis2-1.5.1\bin\wsdl2java.bat -o c:\temp -ss -sd -g -S c:\temp\src -uri ResumeService.wsdl
c:\temp and c:\temp\src are valid directories. Which root directory is the error pointing to?
Thank you
C:\axis2-1.5.1\bin\wsdl2java.bat -o c:\temp -ss -sd -g -S c:\temp\src -uri ResumeService.wsdl
c:\temp and c:\temp\src are valid directories. Which root directory is the error pointing to?
Thank you
shivendra tripathi
Ranch Hand
Posts: 263
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
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
SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand
Posts: 279
posted 15 years ago
Thanks a lot. It worked. I was able to generate with Eclipse.
Thanks for the help.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
Posts: 263
Sunil swain
Greenhorn
Posts: 10
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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)
root cause:
java.lang.NullPointerException
org.apache.jsp.axis2_002dweb.include.httpbase_jsp.jspInit(httpbase_jsp.java:22)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:79)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:314)
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.
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)
root cause:
java.lang.NullPointerException
org.apache.jsp.axis2_002dweb.include.httpbase_jsp.jspInit(httpbase_jsp.java:22)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:79)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:314)
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.
shivendra tripathi
Ranch Hand
Posts: 263
Sunil swain
Greenhorn
Posts: 10
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks for the response. Actually i got the solution by changing the axis2.war file.
posted 15 years ago
I'm curious, what do you mean by "changing the axis2.war file"?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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
Posts: 10
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I was getting the same error ("Root Location Needs to be a Directory!")
In my case, the problem was with the way i had specified the destination folder path for the generated files
Solution:
Changed the wsdl2java command from:
wsdl2java -s -S “D:\Srini\MyProject\Build\Workspaces\ServiceProvider\src-gen” -ssi LoginInterface -u -or -Ejavaversion 1.5 -uri LogonServices.wsdl
to
wsdl2java -s -S \..\src-gen -ssi LoginInterface -u -or -Ejavaversion 1.5 -uri LogonServices.wsdl
In case this helped, congratulations!
In my case, the problem was with the way i had specified the destination folder path for the generated files
Solution:
Changed the wsdl2java command from:
wsdl2java -s -S “D:\Srini\MyProject\Build\Workspaces\ServiceProvider\src-gen” -ssi LoginInterface -u -or -Ejavaversion 1.5 -uri LogonServices.wsdl
to
wsdl2java -s -S \..\src-gen -ssi LoginInterface -u -or -Ejavaversion 1.5 -uri LogonServices.wsdl
In case this helped, congratulations!
posted 9 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
HI ,
I faced the same issue "Root Location Needs to be a Directory!" with axis2 1.4.1 . Got it fixed by changing to a new directory with -o option .
Thanks ,
Prasenjit
I faced the same issue "Root Location Needs to be a Directory!" with axis2 1.4.1 . Got it fixed by changing to a new directory with -o option .
Thanks ,
Prasenjit
| If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |






