java中的方法如下:
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public static boolean CheckUserValid(String UserName,String PassWord)
{
try
{
String endpoint="http://localhost/checklogin/getUser.asmx?wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://localhost/checklogin/getUser.asmx","CheckUserValid"));
call.addParameter("UserName",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("PassWord",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://localhost/checklogin/getUser.asmx");
ReturnValue = (String)call.invoke(new Object[]{UserName,PassWord});
return true;
}
catch(Exception e)
{
ReturnValue=e.toString();
System.err.println(e.toString());
}
return false;
}测试时报错如下:
Feb 6, 2006 10:54:33 AM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost/checklogin/getUser.asmx.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)我应该如何解决这个错误?谢谢
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public static boolean CheckUserValid(String UserName,String PassWord)
{
try
{
String endpoint="http://localhost/checklogin/getUser.asmx?wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://localhost/checklogin/getUser.asmx","CheckUserValid"));
call.addParameter("UserName",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("PassWord",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://localhost/checklogin/getUser.asmx");
ReturnValue = (String)call.invoke(new Object[]{UserName,PassWord});
return true;
}
catch(Exception e)
{
ReturnValue=e.toString();
System.err.println(e.toString());
}
return false;
}测试时报错如下:
Feb 6, 2006 10:54:33 AM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://localhost/checklogin/getUser.asmx.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)我应该如何解决这个错误?谢谢
解决方案 »
- 虚心求教!!下线等!!
- 大家好,能把这个C算法改写成java语言的给100分,测试通过再加100分
- java记事本实现查找下一个功能
- 这个函数有意义吗?
- 提问一个比较弱智的问题(对象比较)
- 关于import及packet的使用,实在搞不定了,请大侠们帮忙!!!
- 目录名最后有个空格 无法删除 知道怎么删除的请来帮忙
- Applet 与 Dialog?
- 寻求complete java 2 certification study guide 的中文版
- 请问在java中怎样打开不同类型的文件,如用word打开.doc文件,用写字板打开.txt文件等等。
- 怎么样将一个String,以‘\n'分割,分派到array或hashtable中
- hibernate in action 中文版本
我是按照这个做的(用jsp),调用可以成功,但返回值总是0