jsp中如何调用web service (vb.net写的,目前在asp中调用没有问题!)

qianguob 2004-07-23 12:33:22
下面是我调用的代码:各位看看有什么问题!

<%@ page language="java"%>
<%@ page import="java.net.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.rmi.*"%>
<%@ page import="javax.xml.namespace.QName" %>
<%@ page import="org.apache.axis.client.Service" %>
<%@ page import="org.apache.axis.client.Call" %>
<%@ page import="javax.xml.rpc.ParameterMode" %>
<%
String location="http://localhost/goodsservice.asmx?wsdl";
URL url = new URL(location);
Call call = new Call(url);
call.setUseSOAPAction(true);
call.setTargetEndpointAddress(new java.net.URL(location));
//call.setSOAPActionURI("http://localhost/goodsservice.asmx");
call.setOperationName(new QName("http://localhost/goodsservice/","TestAccount"));
call.addParameter("SiteID",org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
call.addParameter("password",org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
String number = (String)call.invoke(new Object[] {"123", "123"});
System.out.println(number);
%>

执行以后老是提示:(我用的是tomcat4.1)
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 标头 SOAPAction 的值:。
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

.......
请各位大哥帮忙,谢谢!!!





...全文
188 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qianguob 2004-08-10
  • 打赏
  • 举报
回复
为什么还是没有人回答
qianguob 2004-07-26
  • 打赏
  • 举报
回复
为什么没人回答,??????
qianguob 2004-07-23
  • 打赏
  • 举报
回复
可惜还是不明白:
call.setOperationName(new QName("http://www.my.com/SU","IntAdd"));
这里的地址是 什么?


String endpoint="http://localhost/goodsservice.asmx?wsdl";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://localhost/goodsservice.asmx?wsdl","TestAccount"));

call.addParameter("SiteID",org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
call.addParameter("password",org.apache.axis.Constants.XSD_STRING,ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
String number = (String)call.invoke(new Object[] {"123", "123"});
System.out.println(number);

这是我写的, CMIC(大象) 帮忙看看 有什么问题?
能给正确的例子,谢谢,急用啊。
CMIC 2004-07-23
  • 打赏
  • 举报
回复
http://dev.csdn.net/develop/article/25/25221.shtm

12,166

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧