Hi everyone,
I'm attempting to deploy a Web Service from a simple Java class by
creating a service archive and deploying it to WSAS (Web Services
Application Server).
However, I'm having trouble invoking this service. The structure of my
service is given below (which I then deployed as an .aar file):
- GrouperWS
- META-INF
- services.xml
- lib
- *.jar
- conf
- sources.xml
- test
- GrouperWS.class
GrouperWS.java requires sources.xml for it to initialize properly. I
tried to access the sources.xml using the code below but I'm getting
java.lang.NullPointerException errors when I try to invoke
loadResource(). What am I doing wrong? Any help would be greatly
appreciated.
package test;
import java.io.InputStream;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
import edu.internet2.middleware.grouper.SubjectFinder;
import edu.internet2.middleware.subject.Subject;
import edu.internet2.middleware.subject.SubjectNotFoundException;
import edu.internet2.middleware.subject.SubjectNotUniqueException;
public class GrouperWS {
private final static String GROUPER_PROPERTIES = "conf/sources.xml";
public String loadResource() throws AxisFault{
MessageContext context =
MessageContext.getCurrentMessageContext();
AxisService service = context.getAxisService();
ClassLoader loader = service.getClassLoader();
InputStream stream =
loader.getResourceAsStream(GROUPER_PROPERTIES);
if (stream != null) {
try {
String subjectId = "[EMAIL PROTECTED]";
Subject subject =
SubjectFinder.findById(subjectId);
String user = subject.getId();
return user;
//System.err.println("Found User: " + user);
}
catch (SubjectNotFoundException eSNF) {
// No matching subject id found
//System.err.println(eSNF.getMessage());
String subjNotFoundError=eSNF.getMessage();
return subjNotFoundError;
}
catch (SubjectNotUniqueException eSNU) {
// More than one subject with this subject id was
found
//System.err.println(eSNU.getMessage());
String uniqueError=eSNU.getMessage();
return uniqueError;
}
} else {
return "An error occured";
}
}
}
Regards
--------------
Sanjay Vivek
Web Analyst
Middleware Team
ISS
University of Newcastle Upon Tyne
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]