You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Edgar Castanedo <EC...@AHL.ORG> on 2003/02/25 19:12:59 UTC
problems with call.invoke()
I am having trouble with call.invoke(). My test app is throwing a
SAXException:
- Exception:
org.xml.sax.SAXException: Bad types (int -> class java.lang.String)
at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:285)
at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:893)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
684)
at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:241)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:265)
at org.apache.axis.client.Call.invoke(Call.java:1871)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at TestXML.doPost(TestXML.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:211)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind._efb._plc(.:518)
at com.evermind._efb._adc(.:174)
at com.evermind._cs._yqb(.:614)
at com.evermind._cs._yrb(.:189)
at com.evermind._bx.run(.:62)
org.xml.sax.SAXException: Bad types (int -> class java.lang.String)
Here is what my code looks like (I just started using axis, so any help
would be appreciated):
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.Constants;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class TestXML extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
try {
String userName = "";
String loanData = "";
String action = "EmpLogin";
String params = "";
Boolean compressResp = new Boolean("false");
String endpoint = "http://localhost/soap/test";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new
java.net.URL(endpoint) );
call.setOperationName(new QName("http://localhost",
"SomeAction"));
call.setReturnType(Constants.XSD_STRING);
call.addParameter("UserName", Constants.XSD_STRING,
ParameterMode.IN);
call.addParameter("Data", Constants.XSD_STRING,
ParameterMode.IN);
call.addParameter("Action", Constants.XSD_STRING,
ParameterMode.IN);
call.addParameter("Params", Constants.XSD_STRING,
ParameterMode.IN);
call.addParameter("CompressResp",
Constants.XSD_BOOLEAN, ParameterMode.IN);
String ret = (String) call.invoke( new Object[] {
userName, data, action, params, compressResp } );
System.out.println("Sent 'Hello!', got '" + ret +
"'");
} catch (Exception e) {
System.err.println(e.toString());
}
}
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
this.doPost(request,response);
}
}
Thanks!
Edgar Castanedo