Enunciate http error 404

Posted by malakan on Stack Overflow See other posts from Stack Overflow or by malakan
Published on 2010-04-14T07:58:06Z Indexed on 2010/04/14 8:03 UTC
Read the original article Hit count: 417

Filed under:
|
|

Hi,

I tried to setup a simple project with spring and enunciate+jax-ws/jax-rs annotation, but I didn't get it work.

I used some great tutorial for the enunciate integration tutorial as template:

http://docs.codehaus.org/display/ENUNCIATE/A+Rich+Web+service+API+for+your+favorite+framework

Enunciate create the api-page like in the tutorial, but I get this error : If I open a mount point, for example the REST one (/rest/Service/getService/1), I'll get a 404-Error: NOT_FOUND

Here is sample of my code :

pom.xml:

          <plugin>
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-spring-plugin</artifactId> 
            <version>1.19</version>
              <configuration>
                 <configFile>src/main/webapp/WEB-INF/enunciate.xml</configFile>
              </configuration> 
            <executions>                
              <execution>             
                <goals>
                  <goal>assemble</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

enunciate.xml:

<api-classes>
    <include pattern="com.myProject.model.*"/>
    <include pattern="com.myProject.services.MyService"/>
    <include pattern="com.myProject.services.MyServiceImpl"/>
</api-classes>


<webapp  mergeWebXML="web.xml"/>

<modules>
    <docs docsDir="api" title="myApp API"/>
    <spring-app>  
        <springImport file="spring/applicationContext-config.xml"/> 
    </spring-app>   
</modules>

my service :

package com.myProject.services;

import java.util.List;
import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import com.myProject.model.*;

@WebService
public interface MyService
{
    @GET 
    @Path("getService/{id}")
    public Service getService(@PathParam(value = "id")Integer id); 
}

MyServiceImpl:

package com.myProject.services;

import javax.jws.WebService;
...(all import)
import javax.persistence.EntityManager;

@Service
@Path("/Service")
@WebService (endpointInterface="com.myProjects.services.MyService")
@RemotingDestination(channels={"my-amf"})
public class MyServiceImpl implements MyService 
{
    private final Log logger = LogFactory.getLog(getClass());

    @Autowired
    private MyServiceDao myServiceDao ;

    /*@Inject
    private MyServiceDao myServiceDao ;*/

    public Service getService (Integer id) 
    {
        return myServiceDao.getService (id);
    }
}

and I put @XmlRootElement on the model.

I have tried several configuration, I couldn't get the xml or json response...just 404. Doesn't anyone know what is wrong?

© Stack Overflow or respective owner

Related posts about java

Related posts about spring