axis 调用 c++ 的 webservice

package com.test.axis;

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

import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;


public class GroupCallChatClient {
 /**
  *
  * @param phoneno   手机号码
  * @param ORGANISE_ID   渠道ID
  * @param serviceId   业务编码
  * @return
  */
 
 public static int callWebservice(String phoneno, String ORGANISE_ID,String serviceId){
  /*1表示已订购,0表示没有订购,3表示配置错误,4接口传入参数存在问题,5.数据库错误  6错误 */
  int flag = 6;
  
  String endpoint = "http://211.96.25.137:9091/";
     Service service = new Service();
     Call call = null;
    
     try { 
   call = (Call)service.createCall();
  
     call.setTargetEndpointAddress(endpoint);
    

     call.setOperationName(new QName("http://www.qnuse.com/query_inerface", "query"));
     call.addParameter( "account-id",new QName("http://www.w3.org/2001/XMLSchema", "string"),javax.xml.rpc.ParameterMode.IN);
     call.addParameter( "order-way-id",new QName("http://www.w3.org/2001/XMLSchema", "string"),javax.xml.rpc.ParameterMode.IN);
     call.addParameter( "service-id",new QName("http://www.w3.org/2001/XMLSchema", "string"),javax.xml.rpc.ParameterMode.IN);
     call.setReturnClass(int.class);
    
     Object _resp = call.invoke(new Object[]{phoneno, ORGANISE_ID, serviceId});
    
     if (_resp != null && !"".equals(_resp)){
      flag =  ((Integer) _resp).intValue();
     }   
     System.out.println(phoneno+"---->群呼群聊,返回值:" + flag );
   
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
   System.out.println("群呼群聊出错: " + e);
  }
    
 
  
  return flag;
  
 }

}




c++  的 webservice   的 wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="QUERY_inerface"
 targetNamespace="http://www.qnuse.com/query_inerface.wsdl"
 xmlns:tns="http://www.qnuse.com/query_inerface.wsdl"
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:orderI="http://www.qnuse.com/query_inerface"
 xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
 xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
 xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
 xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>

 <schema targetNamespace="http://www.qnuse.com/query_inerface"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:orderI="http://www.qnuse.com/query_inerface"
  xmlns="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="unqualified"
  attributeFormDefault="unqualified">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
 </schema>

</types>

<message name="queryRequest">
 <part name="account-id" type="xsd:string"/>
 <part name="order-way-id" type="xsd:string"/>
 <part name="service-id" type="xsd:string"/>
</message>

<message name="queryResponse">
 <part name="result" type="xsd:int"/>
</message>

<portType name="QUERY_inerfacePortType">
 <operation name="query">
  <documentation>Service definition of function orderI__query</documentation>
  <input message="tns:queryRequest"/>
  <output message="tns:queryResponse"/>
 </operation>
</portType>

<binding name="QUERY_inerface" type="tns:QUERY_inerfacePortType">
 <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
 <operation name="query">
  <SOAP:operation style="rpc" soapAction=""/>
  <input>
     <SOAP:body use="encoded" namespace="http://www.qnuse.com/query_inerface" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </input>
  <output>
     <SOAP:body use="encoded" namespace="http://www.qnuse.com/query_inerface" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </output>
 </operation>
</binding>

<service name="QUERY_inerface">
 <documentation>gSOAP 2.7.7 generated service definition</documentation>
 <port name="QUERY_inerface" binding="tns:QUERY_inerface">
  <SOAP:address location="http://10.130.28.3:9093/"/>
 </port>
</service>

</definitions>

posted on 2011-11-28 21:25  ggbond1988  阅读(352)  评论(0编辑  收藏  举报

导航