java调.net写的webservice要写SOAPAction的,否则就出这个错误
String sa = webservice的SOAPAction的值
call.setUseSOAPAction(true);
call.setSOAPActionURI(sa);
String sa = webservice的SOAPAction的值
call.setUseSOAPAction(true);
call.setSOAPActionURI(sa);
解决方案 »
- 求教别名异常Every derived table must have its own alias
- 如何用java程序实现上传文件到指定的URL地址
- 【十万火急】没有界面,怎么在后台运行一个方法
- 关于2个session联合使用的问题。
- 请教邮件服务器能发邮件不能收邮件!
- 我迷糊了,用Struts 做了一个没有登陆的用户访问该页时出错的程序,我崩溃了。。。
- 各位大虾:我在JBuilder2006中生成weblogic下的webservice后发现wsdl中函数参数名称不是我定义的...请指教
- 在web浏览器上类似于windows窗体的效果如何是实现的?
- 求救!web服务运行问题!
- 哪儿有j2EE 1.3源码下载,sun的网站上好像只有1.2.1版本的,没有1.3的啊??
- 请问jsp能否像asp一样不设odbc直接用ado(类似方法)连接数据库?如何在tomcat中像iis那样设虚拟目录呀??
- 调试struts数据库实例出现的问题,我用的是JavaWebStudio,在线等(8点钟走)
以java 为客户端的话, 有多种技术可以访问我们的Web Service。以下演示在J2SE 1.4.2 版本下访问Web
Service 的2 种方式。
Axis
需要下载axis, 地址为:http://apache.linuxforum.net/dist/ws/axis/1_1/axis-1_1-src.zip
代码如下:
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class t2 {
public static void main(String[] args) {
long time=System.currentTimeMillis();
try {
String endpoint="http://localhost/UserX/biz.asmx";
Service service = new Service();
Call call = (Call)service.createCall();
8848.com Web Service 说明文档
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new
QName("http://localhost/UserX/bizinfo","get_count"));
call.addParameter("ID", org.apache.axis.Constants.XSD_STRING,
ParameterMode.IN);
call.addParameter("pwd",org.apache.axis.Constants.XSD_STRING,
ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://localhost/UserX/bizinfo/get_count");
String day = (String)call.invoke(new Object[] {"111", "s111"});
System.out.println(day);
} catch (Exception e) {
System.err.println(e.toString());
}
System.out.println("Total time is: "+(System.currentTimeMillis()-time));
}
}