tags:

views:

607

answers:

2

OKay I lost alsmost the whole day on this. I have a webapp where I would like to add AXIS2 and start working. I added AxisServlets in the web.xml file like -

   <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

  <servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>

I also added Services.xml file like

<service name="ReportViewerService">
    <description>
        This is a sample Web Service for illustrating Attachments API of Axis2
    </description>
    <parameter name="ServiceClass">myclass</parameter>
    <operation name="getReport">
        <actionMapping>urn:getReport</actionMapping>
        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </operation>
</service>

The directory structure is as mentioned here

WEB-ING
  | - conf
  |     |- axis2.xml
  |-lib
  |  |- all libs
  |-services
       |-ReportViewerService
               | - META-INF
                     |-services.xml
  |- web.xml

The problem is - after all of these, the service endpoint will not come, I can not see the WSDL file http://localhost:8080/BOReportingServer/services/ReportViewerService?wsdl -- this gives an exception like -

Throwable occurred: javax.servlet.ServletException: File &quot;/axis2-web/listSingleService.jsp&quot; not found
A: 

You also deployed axis2.war in your servlet container, right?

In order for Axis2 to work properly, you need to deploy it to a servlet container. A tutorial can be found here. You'll know you've done it properly when the Axis2 "Happy" page can be shown.

Once you've done that, you should be able to bundle up your service (in the structure you've described above in your question) into an .aar file and deploy it using the axis2 servlet.

Michael Sharek
No, why do I need to deploy axis2.war file? I am trying to embed it in my webapp.
Shamik
Axis2 _IS_ a web app...that's how it provides services. Trust me, this step is required. :)
Michael Sharek
Can you please tell me the exact steps then? Like where from where I should download it and in this case where would my services stay?
Shamik
OK I've updated my answer...good luck :)
Michael Sharek
A: 

Finally I am able to embed AXIS2 in my webapp. It is as simple as mentioned in the tutorial , only thing is - I never got the jars properly placed under WEB-INF/lib directory. Once I started from the very beginning and removed all the unwanted jars and duplicate jars from the WEB-INF/lib directory, it started working.

Shamik