当前位置: 代码迷 >> Web前端 >> 用JAVA碉.net WebService的步骤
  详细解决方案

用JAVA碉.net WebService的步骤

热度:194   发布时间:2012-09-22 21:54:54.0
用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;
}

  相关解决方案