I'm pasting the code for you below. I finally got it working by trial
and error and I'm not sure exactly what I was doing wrong. I was trying
to make publish my service using three different methods:
#1. Using the DispatcherServlet in web.xml, which reads the
xfire-servlet.xml file containing the
Jsr181WebAnnotations/Jsr181HandlerMapping/SimpleUrlHandlerMapping
combination.
#2. Using the DispatcherServlet in web.xml, which reads the
xfire-servlet.xml file containing the
XFireExporter/SimpleUrlHandlerMapping combinations.
#3. XFireConfigurableServlet in the web.xml, which ignores the
xfire-servlet.xml and instead uses the META-INF/xfire/services.xml file
which contains my reference to the webserice using the
org.codehaus.xfire.jaxws.JAXWSServiceFactory.
I proved the method #3 would work, and now I've got #1 working as well.
Like I said, I'm not sure what I did to fix it, but I did remove the
User.aegis.xml and School.aegis.xml files that were apparently still
being read even though I was using the
Jsr181WebAnnotations/Jsr181HandlerMapping in the xfire-servlet.xml which
I figured would use the annotations and ignore the mapping files. I
thought the mapping files would only get read when I was using the
default method for exporting the service. (i.e. not declaring the
JAXWSServiceFactory in the services.xml in case #3, or not using the
Jsr181WebAnnotations/Jsr181HandlerMapping beans in the
xfire-servlet.xml). This is all very confusing!
Regardless, my service class and interface are pasted below. If you
want, I can post all of my code in more detail. I think you have to
make sure the web.xml file and xfire-servlet.xml file are setup
perfectly for this all to work.
------Service interface--------
package org.winston.ws;
import java.util.Collection;
import org.winston.domain.School;
import org.winston.domain.User;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
@WebService(targetNamespace = "org.winston.ws")
public interface WinstonWebService
{
public String echo(String echoString);
public User getUser(String userId);
@WebMethod()
@WebResult(name = "UsersArray", targetNamespace = "org.winston.ws")
public User[] getUsersArray();
@WebMethod()
@WebResult(name = "UsersList", targetNamespace = "org.winston.ws")
public Collection<User> getUsersList();
@WebMethod()
@WebResult(name = "SchoolsArray", targetNamespace =
"org.winston.ws")
public School[] getSchoolsArray();
@WebMethod()
@WebResult(name = "SchoolsList", targetNamespace =
"org.winston.ws")
public Collection<School> getSchoolsList();
}
--------Service Implementation class--------
package org.winston.ws.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import org.winston.domain.School;
import org.winston.domain.User;
import org.winston.ws.WinstonWebService;
@WebService(serviceName = "WinstonWebService", endpointInterface =
"org.winston.ws.WinstonWebService")
public class WinstonWebServiceImpl
implements WinstonWebService
{
public String echo(String echoString)
{
return "Hello " + echoString;
}
public User getUser(String userId)
{
System.out.println("getUser(" + userId + ")");
User returnUser = new User();
returnUser.setId(new Long(userId));
returnUser.setUsername("TestUser");
returnUser.setPassword("password");
returnUser.setEnabled(true);
returnUser.setEmail("[EMAIL PROTECTED]");
returnUser.setLastLogin(new Long(System.currentTimeMillis()));
return returnUser;
}
public User[] getUsersArray()
{
User[] userArray = new User[4];
userArray[0] = new User();
userArray[0].setId(new Long(50));
userArray[0].setUsername("Bob Smith");
userArray[0].setPassword("password");
userArray[0].setEnabled(true);
userArray[0].setEmail("[EMAIL PROTECTED]");
userArray[0].setLastLogin(new
Long(System.currentTimeMillis()));
...(truncated).....
userArray[3] = new User();
userArray[3].setId(new Long(80));
userArray[3].setUsername("Tammy Johnson");
userArray[3].setPassword("password");
userArray[3].setEnabled(true);
userArray[3].setEmail("[EMAIL PROTECTED]");
userArray[3].setLastLogin(new
Long(System.currentTimeMillis()));
return userArray;
}
public Collection<User> getUsersList()
{
List returnUserList = new ArrayList();
User newUser1 = new User();
newUser1.setId(new Long(50));
newUser1.setUsername("Bob Smith");
newUser1.setPassword("password");
newUser1.setEnabled(true);
newUser1.setEmail("[EMAIL PROTECTED]");
newUser1.setLastLogin(new Long(System.currentTimeMillis()));
returnUserList.add(newUser1);
...(truncated).....
User newUser4 = new User();
newUser4.setId(new Long(80));
newUser4.setUsername("Tammy Johnson");
newUser4.setPassword("password");
newUser4.setEnabled(true);
newUser4.setEmail("[EMAIL PROTECTED]");
newUser4.setLastLogin(new Long(System.currentTimeMillis()));
returnUserList.add(newUser4);
return returnUserList;
}
public School[] getSchoolsArray()
{
User[] userArray = new User[4];
School[] schoolArray = new School[4];
schoolArray[0] = new School();
schoolArray[0].setId(new Long(1));
schoolArray[0].setName("Winston School");
schoolArray[0].setAddress1("100 No Way");
schoolArray[0].setAddress2("");
schoolArray[0].setCity("Dallas");
schoolArray[0].setState("TX");
schoolArray[0].setZipcode("12345");
...(truncated).....
schoolArray[3] = new School();
schoolArray[3].setId(new Long(4));
schoolArray[3].setName("St. Marx");
schoolArray[3].setAddress1("503 Some Lane");
schoolArray[3].setAddress2("Bldg 100");
schoolArray[3].setCity("Ft. Worth");
schoolArray[3].setState("TX");
schoolArray[3].setZipcode("11545");
return schoolArray;
}
public Collection<School> getSchoolsList()
{
List returnSchoolList = new ArrayList();
School newSchool1 = new School();
newSchool1.setId(new Long(1));
newSchool1.setName("Winston School");
newSchool1.setAddress1("100 No Way");
newSchool1.setAddress2("");
newSchool1.setCity("Dallas");
newSchool1.setState("TX");
newSchool1.setZipcode("12345");
returnSchoolList.add(newSchool1);
...(truncated).....
School newSchool4 = new School();
newSchool4.setId(new Long(4));
newSchool4.setName("St. Marx");
newSchool4.setAddress1("503 Some Lane");
newSchool4.setAddress2("Bldg 100");
newSchool4.setCity("Ft. Worth");
newSchool4.setState("TX");
newSchool4.setZipcode("11545");
returnSchoolList.add(newSchool4);
return returnSchoolList;
}
}
On Thu, Mar 23, 2006 at 3:00 PM, Jason Tesser wrote:
would you mind pasting your org.winston.ws.impl.WinstonWebServiceImpl
class here? i am trying to do a similar thing and cannot even get teh
@WebService to work :-s
On 3/23/06, William White < [EMAIL PROTECTED] <
javascript:lzSetCanvasAttribute('js_mailto',
'[EMAIL PROTECTED]')> > wrote: Hi All,
...(truncated).....