您当前的位置: 首页 >  phymat.nico Java

Java调用C++webservice接口

phymat.nico 发布时间:2015-01-10 09:40:08 ,浏览量:9

import javax.xml.namespace.QName;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

 

/**
  *
  * 功能描述:
  * 时间:2013-8-21
  * @author:zengxinliang
  */
 public static String sendMsg(String method,String param1,String param2)throws Exception{
  String url=Global.getPath("lc_url");//联创url
  String result="";
  String sendParam=null;
  String sendContent="";
  if(method.equals("StaLogon")||method.equals("StaLogout")){//站点登录或者退出
   sendParam="pStaInfoXml";
   sendContent=""+param1+""+param2+"";
  }else if(method.equals("CheckUserByCardNo")){
   sendParam="pCheckUserReqXml";
   sendContent=""+param1+""+param2+"";
  }
  Service service = new Service();
  Call call=(Call)service.createCall();
  call.setTargetEndpointAddress(url);//webservice路径
  call.setOperationName(new QName("http://tempuri.org/ns1.xsd",method));//method接口名称new QName("http://tempuri.org/ns1.xsd",method)命名空间
  call.addParameter(sendParam, org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);//方法参数
  result=(String)call.invoke(new Object[]{sendContent});
  return result;
 }

关注
打赏
查看更多评论

phymat.nico

暂无认证

  • 9浏览

    0关注

    1946博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录