chenmt
发贴: 4
积分: 0
|
于 2006-03-23 10:20
我用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());} } }
|