我这里用的是java+axis1.4开发的客户端,对方是.net服务端,调用是成功的(对方出错信息反馈回来了),但是对方打印出参数都是空的:java:Call call = (Call)service.createCall();
URL u = new URL(serUrl);
call.setTargetEndpointAddress(u);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/test");
call.setOperationName(new QName("http://tempuri.org/","test");call.addParameter(new QName("http://tempuri.org/","param1"),XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);Object obj = call.invoke("test",new Object[]{"xxxxx"});
System.out.println(obj);--------------对方程序
[WebService(Namespace="http://tmpuri.org/")]
...
public class....
public String test(String param1){
if(string.IsNullOrEmpty(param1)) throw new ApplicationException("参数为空");//这句话客户端能获取到
奇怪的是我客户端的程序在其他项目中也是这么写的,而且能够正常使用,唯独这个项目不好使,请各位大侠分析一下原因,谢谢。
URL u = new URL(serUrl);
call.setTargetEndpointAddress(u);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/test");
call.setOperationName(new QName("http://tempuri.org/","test");call.addParameter(new QName("http://tempuri.org/","param1"),XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);Object obj = call.invoke("test",new Object[]{"xxxxx"});
System.out.println(obj);--------------对方程序
[WebService(Namespace="http://tmpuri.org/")]
...
public class....
public String test(String param1){
if(string.IsNullOrEmpty(param1)) throw new ApplicationException("参数为空");//这句话客户端能获取到
奇怪的是我客户端的程序在其他项目中也是这么写的,而且能够正常使用,唯独这个项目不好使,请各位大侠分析一下原因,谢谢。
解决方案 »
- flex开发 ActionScript中ArrayCollection的问题
- dom解析xml遇到点小麻烦
- 按钮调用js提交值到表单的问题
- 我用webwork框架,现在用到radio,就是想问一下,还可以把radio绑定啊?
- 哪里下载struts呀! 要配置吗?
- 请教如何在jb9里面升级tomcat
- 诚聘:jsp,bean+数据库软件工程师
- 关于jsp用jdbc直接连接oracle数据库的问题
- 我想问一下,自己拉的项目,大概在几万的价格,应该问自己的公司那多少提成才比较合适呢
- Spring中如何实现插入数据后调用存储过程,且在同一事务里,如何证明。
- java 调用sqlldr乱码问题
- 关于数据库的
[SoapRpcMethod(Action="http://www.xxx.com/Rpc",
RequestNamespace="http://www.xxx.com/SU",ResponseNamespace="http://www.xxx.com/SU")]
[WebMethod]
public string getName(string name)
{
return "Hello"+name;
} 是[SoapRpcMethod(Action="http://www.xxx.com/Rpc",
RequestNamespace="http://www.xxx.com/SU",ResponseNamespace="http://www.xxx.com/SU")]
这个东西吗?
是要实现什么功能?你调用的时候参数是字符串还是对象等等 ?参数应当为期设置addParameter值。//OK
public static void quickReg(String tel)
{
final String wsdl = "http://localhost:8000/services/UserInfoWebService";
Service service = new Service();
Call call;
try { call = (Call) service.createCall();
try {
call.setTargetEndpointAddress(new java.net.URL(wsdl));
} catch (MalformedURLException e) {
e.printStackTrace();
}
call.setOperationName("quick");//WSDL里面描述的接口名称
call.getMessageContext().setUsername("user");
call.getMessageContext().setPassword("password");
call.addParameter("userphone", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);//接口的参数
call.addParameter("checkcode", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);//接口的参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
Object xml;
try {
xml = (Object)call.invoke(new Object[]{tel,"code"});
//给方法传递参数,并且调用方法
System.out.println("result is "+xml);
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }供楼主参考下,参数的传入。