首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

用JAVA碉.net WebService的步骤

2012-09-22 
用JAVA碉.net WebService的方法import javax.xml.namespace.QNameimport org.apache.axis.client.Callim

用JAVA碉.net WebService的方法
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.ParameterMode;

public class TelWebService {

// String result = null;
String outxml = null;
public TelWebService() {
}
public String querySSHFFee(String areaCode, String phoneNumber) {
try {
String strXML="<?xml version="1.0" encoding="utf-8" ?><list><obj> ";
strXML +="<AreaId>"+ areaCode + "</AreaId>" + "<Number>"+ phoneNumber + "</Number>";
strXML+="</obj></list>";
String endpoint="http://loaclhost/InterfaceWs/SMService.asmx";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://tempuri.org/SU","FeeTotalQueryXml"));
call.addParameter("strXML",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/Rpc");
outxml = (String)call.invoke(new Object[]{strXML});

}
catch (Exception e) {System.err.println(e.toString());}

  return outxml;
}

热点排行