Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » WebService/XML/JSON/SOAP/SOA » Web Services  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 调用.net的web service时,返回类型设置问题?
chenmt





发贴: 4
积分: 0
于 2006-03-23 10:20 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我用JAVA写的客户端程序代码如下(要调用.net webservice中的一个方法),要求返回类型为如下这种类型,这要如何设置? call.setReturnType(这要怎么写?);请高手指点一下啊,我对JAVA不熟,伸出援手一下啊,谢谢了.
public class AddLocationRespType {
Integer hRet;
}

客户端源代码:
package hello;
import java.util.Date;
import java.text.DateFormat;
import java.util.Date;
import java.text.DateFormat;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.lang.Integer;
import javax.xml.rpc.ParameterMode;
public class TestNetService {

public static void main(String[] args) {
try {
AddLocationReqType addInfo = new AddLocationReqType();
addInfo.basePrice= new Integer("000200");
addInfo.billDate="2006-03-23";
addInfo.groupId="1002";
addInfo.groupName=new java.math.BigInteger("999999", 16).toByteArray();
addInfo.homeCity=new Integer("0592");
addInfo.openDate="2006-03-23";
addInfo.operatorName="chenmt";
addInfo.paymentMsisdn=new Integer("123456789");
addInfo.status=new Integer(1);

String endpoint="http://220.200.1.190/SL/SL.asmx";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://samp.service.samp.neu","AddLocation"));
call.addParameter("in0",org.apache.axis.encoding.XMLType.XSD_DATE,javax.xml.rpc.ParameterMode.IN);
call.setReturnType(); ---------------------括号中要填什么?------------

call.setUseSOAPAction(true);
call.setSOAPActionURI("http://samp.service.samp.neu/AddLocation");
AddLocationRespType k = (AddLocationRespType)call.invoke(new Object[]{addInfo});
System.out.println( "result is " + k.hRet.toString() + ".");
}
catch (Exception e) {System.err.println(e.toString());}
}
}




话题树型展开
人气 标题 作者 字数 发贴时间
12468 调用.net的web service时,返回类型设置问题? chenmt 1798 2006-03-23 10:20
10184 Re:调用.net的web service时,返回类型设置问题? chenmt 490 2006-03-23 10:57
10204 Re:调用.net的web service时,返回类型设置问题? chenmt 16 2006-03-23 14:05
11099 Re:调用.net的web service时,返回类型设置问题? chenmt 2 2006-03-23 15:08

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923