Thanks for the sample code. I am stranger to NetBeans so... :(
BTW, I tried my client code in the Servlet(.java) and it's working. I will try forwarding from .java to .jsp. Hopefully it will work on time for my deadline next week.
:)
-Sri
At 01:57 PM 5/13/2005, you wrote:
I've been working on integrating Axis with Netbeans and I just finished the trivial case of using a JSP to consume a WebService.
------------------
<[EMAIL PROTECTED] contentType="text/html"%>
<[EMAIL PROTECTED] pageEncoding="UTF-8"%>
<[EMAIL PROTECTED] import="play.*"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%
String val="earnest";
try{
HiSEI hiStub = new HiSEIServiceLocator().getHiSEIPort();
out.println(hiStub.sayHi("Allison"));
}catch (Exception ex){}%>
</body>
</html>
----------------
The import references the package play which was created by wsdl2java and contains the two classes referenced in the scriptlet.
dga
On 5/13/05, Srinadh Karumuri <[EMAIL PROTECTED]> wrote:
- Does any one have a sample code for calling an Axis Web service from a JSP page?
- Interesting thing is:
- Same code when I tried on Tomcat 3 gives me the following exception:
- Internal Servlet Error:
java.lang.IllegalStateException: Response has already been- committed
- at
- java.lang.Throwable.fillInStackTrace(Native Method)
- at
- java.lang.Throwable.fillInStackTrace(Compiled Code)
- at
- java.lang.Throwable.(Compiled Code)
- at
- java.lang.Exception.(Compiled Code)
- at
- java.lang.RuntimeException.(Compiled Code)
- at
- java.lang.IllegalStateException.(Compiled Code)
- at
- org.apache.tomcat.core.HttpServletResponseFacade.sendError(Compiled
- Code)
- :
- :
- -Sri
- At 01:05 PM 5/13/2005, you wrote:
- Michael,
- I checked the HttpClient and understood what you meant. So, it should be working with my web app on the same Tomcat.
- As it shows in the RootCouse:
- root cause
java.lang.LinkageError: loader constraints violated when linking- javax/xml/soap/SOAPMessage class
- at
- org.apache.axis.client.Call.<init>(Call.java:263)
- at
- org.apache.axis.client.Service.createCall
- (Service.java:566)
- I started using a simple JSP page but still my Call.init is failing.
- -Sri
- At 10:18 AM 5/13/2005, you wrote:
- Michael,
- Thanks for your reply.
- I just started calling the web service in the .jsp file.
- Here is my client code from .jsp file:
- <%
- String endpoint =
- "http://localhost:8080/bserv/services/EmployeeDataService ";
- String[] args = {"getEmployeeLateTSDataArray", "22624", "8524"};
- String method = args[0];
new Service();
- String arg1 = args[1];;
- String arg2 = args[2];;
- Service service =
- Call call =
null;
- QName qname =
null;
- Class cls =
null;
- qname =
new QName("EmployeeLateTSArray", "EmployeeLateTSBean");
- TypeMappingRegistry tmr = service.getTypeMappingRegistry();
- TypeMapping tmlts = tmr.createTypeMapping();
- try {
- tmlts.register(
"com.bbn.ws.EmployeeLateTSBean"),
- Class.forName(
- qname,
- new org.apache.axis.encoding.ser.BeanSerializerFactory(EmployeeLateTSBean.class,qname),
- new org.apache.axis.encoding.ser.BeanDeserializerFactory(EmployeeLateTSBean.class,qname));
- }
catch (ClassNotFoundException e1) {
- e1.printStackTrace();
"http://schemas.xmlsoap.org/soap/encoding/ ", tmlts);
- }
- tmr.register(
- qname =
new QName("EmployeeLateTSArray", "EmployeeLateTSBeanArray");
- call = (Call) service.createCall();
- call.setReturnType (qname);
- try {
- call.setTargetEndpointAddress(
new java.net.URL(endpoint));
- }
catch (MalformedURLException e2) {
- e2.printStackTrace();
"admnum", XMLType.XSD_INTEGER, ParameterMode.IN);
- }
- call.setOperationName(method);
- call.addParameter(
- call.addParameter(
"mgrnum", XMLType.XSD_INTEGER, ParameterMode.IN);
- call.setReturnType(qname);
"Called method: " + method + "(" + arg1 + "," + arg2 + ")");
- System.out.println(
- EmployeeLateTSBean e[] = (EmployeeLateTSBean[])call.invoke(
new Object[] { new Integer(arg1), new Integer(arg2) });
- %>
- <%= e[0].toString(); %>
- I will look into using HttpClient as you suggested.
- Thanks again,
- Sri
- At 05:47 PM 5/12/2005, Michael Oliver wrote:
- Sri,
- Its hard to tell what you are doing because we don't see any of the
- source, but I can tell you that I use commons HttpClient to access one
- servlet from another servlet all day long with no problems so you can at
- least know that should work.
- Michael Oliver
- CTO
- Alarius Systems LLC
- 6800 E. Lake Mead Blvd, #1096
- Las Vegas, NV 89156
- Phone:(702)643-7425
- Fax:(702)974-0341
- *Note new email changed from [EMAIL PROTECTED]
--
It used to be that machines automated work, giving us more time to do other things. But now machines automate the production of attention-consuming information, which takes our time. For example, if one person sends the same e-mail message to 10 people, then 10 people have to respond.
Esther Dyson
