项目要用到AXIS的调用。由于之前对接口的专注比较少。一般不是很复杂类型的接口还能搞定,
但是这个接口比较特殊。客户端传入的参数是一个自定义的类型,必须要同服务端一致。google一下也没找到
正确的解决方案,小弟只好请教各位大拿。
1、wsdl如下:
<?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions targetNamespace="http://cintel.com/ws/cc/wsdl/v1_0/agent/service" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://cintel.com/ws/cc/wsdl/v1_0/agent/service" xmlns:intf="http://cintel.com/ws/cc/wsdl/v1_0/agent/service" xmlns:tns1="http://cintel.com/ws/cc/wsdl/v1_0/agent/local" xmlns:tns2="http://cintel.com/ws/cc/wsdl/v1_0/common/model" xmlns:tns3="http://cintel.com/ws/cc/wsdl/v1_0/agent/model" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <!-- WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT) --> - <wsdl:types> - <schema elementFormDefault="qualified" targetNamespace="http://cintel.com/ws/cc/wsdl/v1_0/agent/local" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://cintel.com/ws/cc/wsdl/v1_0/agent/model" /> <import namespace="http://cintel.com/ws/cc/wsdl/v1_0/common/model" /> - <element name="totalForList"> - <complexType> - <sequence> <element name="corpVccId" type="xsd:string" /> </sequence> </complexType> </element> - <element name="totalForListResponse"> - <complexType> - <sequence> <element name="totalItem" type="xsd:int" /> </sequence> </complexType> </element> - <element name="list"> - <complexType> - <sequence> <element name="startItem" type="xsd:int" /> <element name="maxItem" type="xsd:int" /> <element name="corpVccId" type="xsd:string" /> </sequence> </complexType> </element> - <element name="listResponse"> - <complexType> - <sequence> <element maxOccurs="unbounded" name="agentContextArray" type="tns3:AgentContext" /> </sequence> </complexType> </element> - <element name="find"> - <complexType> - <sequence> <element name="agentId" type="xsd:string" /> </sequence> </complexType> </element> - <element name="findResponse"> - <complexType> - <sequence> <element name="agentContext" type="tns3:AgentContext" /> </sequence> </complexType> </element> - <element name="save"> - <complexType> - <sequence> <element name="agentInfo" type="tns3:AgentInfo" /> </sequence> </complexType> </element> - <element name="saveResponse"> - <complexType> - <sequence> <element name="result" type="xsd:boolean" /> </sequence> </complexType> </element> - <element name="update"> - <complexType> - <sequence> <element name="agentInfo" type="tns3:AgentInfo" /> </sequence> </complexType> </element> - <element name="updateResponse"> - <complexType> - <sequence> <element name="result" type="xsd:boolean" /> </sequence> </complexType> </element> - <element name="delete"> - <complexType> - <sequence> <element name="agentId" type="xsd:string" /> </sequence> </complexType> </element> - <element name="deleteResponse"> - <complexType> - <sequence> <element name="result" type="xsd:boolean" /> </sequence> </complexType> </element> - <element name="listAgentGroup"> - <complexType> - <sequence> <element name="agentId" type="xsd:string" /> <element name="groupType" type="xsd:AgentGroup" /> </sequence> </complexType> </element> - <element name="listAgentGroupResponse"> - <complexType> - <sequence> <element maxOccurs="unbounded" name="agentGroupArray" type="tns3:AgentGroup" /> </sequence> </complexType> </element> - <element name="loadAgentInfoForTelBar"> - <complexType> - <sequence> <element name="corpVccId" type="xsd:string" /> <element name="shortAgentId" type="xsd:string" /> <element name="agentPwd" type="xsd:string" /> <element name="defaultBindTel" type="xsd:string" /> </sequence> </complexType> </element> - <element name="loadAgentInfoForTelBarResponse"> - <complexType> - <sequence> <element name="agentInfoForTelBar" type="tns3:AgentInfoForTelBar" /> </sequence> </complexType> </element> </schema> - <schema targetNamespace="http://cintel.com/ws/cc/wsdl/v1_0/common/model" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://cintel.com/ws/cc/wsdl/v1_0/agent/model" /> - <complexType name="ServiceException"> - <sequence> <element name="resultCode" type="xsd:string" /> <element name="text" type="xsd:string" /> <element maxOccurs="unbounded" minOccurs="0" name="variables" type="xsd:string" /> </sequence> </complexType> <element name="ServiceException" type="tns2:ServiceException" /> </schema> - <schema targetNamespace="http://cintel.com/ws/cc/wsdl/v1_0/agent/model" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://cintel.com/ws/cc/wsdl/v1_0/common/model" /> - <complexType name="AgentContext"> - <sequence> <element name="corpVccId" type="xsd:string" /> <element name="agentId" type="xsd:string" /> <element name="agentName" type="xsd:string" /> <element name="effective" type="xsd:int" /> <element name="agentType" type="xsd:int" /> <element name="agentPasswd" type="xsd:string" /> <element name="expirationStart" type="xsd:string" /> <element name="expirationEnd" type="xsd:string" /> <element name="bindMode" type="xsd:int" /> <element name="phoneNumber" nillable="true" type="xsd:string" /> <element name="forward" nillable="true" type="xsd:int" /> <element name="forwardNumber" nillable="true" type="xsd:string" /> <element name="answerType" type="xsd:int" /> <element name="autoAnswer" type="xsd:int" /> <element name="autoWorkOn" type="xsd:int" /> <element name="autoWorkSubstate" type="xsd:int" /> <element name="autoWorkInterval" type="xsd:int" /> <element name="doNotDistribute" type="xsd:int" /> <element name="avType" type="xsd:int" /> <element name="recordType" type="xsd:int" /> <element name="recordSample" type="xsd:int" /> <element name="kickoff" type="xsd:int" /> <element name="monitorId" nillable="true" type="xsd:string" /> <element name="monitorState" type="xsd:int" /> <element name="loginMode" type="xsd:int" /> <element name="deviceId" nillable="true" type="xsd:string" /> </sequence> </complexType> - <complexType name="AgentFuncConfig"> - <sequence> <element name="outCall" type="xsd:int" /> <element name="keepCall" type="xsd:int" /> <element name="activeOver" type="xsd:int" /> <element name="forwardFlag" type="xsd:int" /> <element name="meetingFlag" type="xsd:int" /> <element name="askingFlag" type="xsd:int" /> <element name="passFlag" type="xsd:int" /> <element name="bridgeFlag" type="xsd:int" /> <element name="recordFlag" type="xsd:int" /> <element name="listenFlag" type="xsd:int" /> <element name="insertFlag" type="xsd:int" /> <element name="proxyFlag" type="xsd:int" /> <element name="forceOverFlag" type="xsd:int" /> <element name="pronounceFlag" type="xsd:int" /> <element name="lockFlag" type="xsd:int" /> <element name="muteFlag" type="xsd:int" /> </sequence> </complexType> - <complexType name="AgentInfo"> - <sequence> <element name="agentContext" type="tns3:AgentContext" /> <element name="agentFuncConfig" type="tns3:AgentFuncConfig" /> </sequence> </complexType> - <complexType name="AgentGroup"> - <sequence> <element name="serviceId" type="xsd:string" /> <element name="serviceName" nillable="true" type="xsd:string" /> <element name="priority" type="xsd:int" /> </sequence> </complexType> - <complexType name="CtiServerCtx"> - <sequence> <element name="ctiServerIP" type="xsd:string" /> <element name="ctiServerPort" type="xsd:string" /> <element name="ctiBackServerIP" nillable="true" type="xsd:string" /> <element name="ctiBackServerPort" nillable="true" type="xsd:string" /> <element name="vasServerIP" nillable="true" type="xsd:string" /> <element name="vasServerPort" nillable="true" type="xsd:string" /> <element name="ftpServerIP" nillable="true" type="xsd:string" /> <element name="ftpServerPort" nillable="true" type="xsd:string" /> <element name="ftpUserName" nillable="true" type="xsd:string" /> <element name="ftpPassword" nillable="true" type="xsd:string" /> <element name="ftpDirectory" nillable="true" type="xsd:string" /> </sequence> </complexType> - <complexType name="SipServerCtx"> - <sequence> <element name="sipServerName" type="xsd:string" /> <element name="sipServerIP" nillable="true" type="xsd:string" /> <element name="sipServerPort" type="xsd:int" /> <element name="authType" type="xsd:int" /> <element name="protocol" type="xsd:string" /> <element name="domain" nillable="true" type="xsd:string" /> </sequence> </complexType> - <complexType name="AgentInfoForTelBar"> - <sequence> <element name="agentContext" type="tns3:AgentContext" /> <element name="bindExtPhoneNumber" type="xsd:string" /> <element name="agentFuncConfig" type="tns3:AgentFuncConfig" /> <element name="ctiServerCtx" type="tns3:CtiServerCtx" /> <element name="sipServerCtx" nillable="true" type="tns3:SipServerCtx" /> </sequence> </complexType> </schema> </wsdl:types> - <wsdl:message name="loadAgentInfoForTelBarResponse"> <wsdl:part element="tns1:loadAgentInfoForTelBarResponse" name="parameters" /> </wsdl:message> + <wsdl:message name="totalForListResponse"> <wsdl:part element="tns1:totalForListResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="findRequest"> <wsdl:part element="tns1:find" name="parameters" /> </wsdl:message> - <wsdl:message name="listAgentGroupRequest"> <wsdl:part element="tns1:listAgentGroup" name="parameters" /> </wsdl:message> - <wsdl:message name="deleteRequest"> <wsdl:part element="tns1:delete" name="parameters" /> </wsdl:message> - <wsdl:message name="ServiceException"> <wsdl:part element="tns2:ServiceException" name="ServiceException" /> </wsdl:message> - <wsdl:message name="saveRequest"> <wsdl:part element="tns1:save" name="parameters" /> </wsdl:message> - <wsdl:message name="totalForListRequest"> <wsdl:part element="tns1:totalForList" name="parameters" /> </wsdl:message> - <wsdl:message name="updateRequest"> <wsdl:part element="tns1:update" name="parameters" /> </wsdl:message> - <wsdl:message name="findResponse"> <wsdl:part element="tns1:findResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="listResponse"> <wsdl:part element="tns1:listResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="updateResponse"> <wsdl:part element="tns1:updateResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="loadAgentInfoForTelBarRequest"> <wsdl:part element="tns1:loadAgentInfoForTelBar" name="parameters" /> </wsdl:message> - <wsdl:message name="saveResponse"> <wsdl:part element="tns1:saveResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="listRequest"> <wsdl:part element="tns1:list" name="parameters" /> </wsdl:message> - <wsdl:message name="listAgentGroupResponse"> <wsdl:part element="tns1:listAgentGroupResponse" name="parameters" /> </wsdl:message> - <wsdl:message name="deleteResponse"> <wsdl:part element="tns1:deleteResponse" name="parameters" /> </wsdl:message> - <wsdl:portType name="AgentService"> - <wsdl:operation name="totalForList"> <wsdl:input message="impl:totalForListRequest" name="totalForListRequest" /> <wsdl:output message="impl:totalForListResponse" name="totalForListResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="list"> <wsdl:input message="impl:listRequest" name="listRequest" /> <wsdl:output message="impl:listResponse" name="listResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="find"> <wsdl:input message="impl:findRequest" name="findRequest" /> <wsdl:output message="impl:findResponse" name="findResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="save"> <wsdl:input message="impl:saveRequest" name="saveRequest" /> <wsdl:output message="impl:saveResponse" name="saveResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="update"> <wsdl:input message="impl:updateRequest" name="updateRequest" /> <wsdl:output message="impl:updateResponse" name="updateResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="delete"> <wsdl:input message="impl:deleteRequest" name="deleteRequest" /> <wsdl:output message="impl:deleteResponse" name="deleteResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="listAgentGroup"> <wsdl:input message="impl:listAgentGroupRequest" name="listAgentGroupRequest" /> <wsdl:output message="impl:listAgentGroupResponse" name="listAgentGroupResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> - <wsdl:operation name="loadAgentInfoForTelBar"> <wsdl:input message="impl:loadAgentInfoForTelBarRequest" name="loadAgentInfoForTelBarRequest" /> <wsdl:output message="impl:loadAgentInfoForTelBarResponse" name="loadAgentInfoForTelBarResponse" /> <wsdl:fault message="impl:ServiceException" name="ServiceException" /> </wsdl:operation> </wsdl:portType> - <wsdl:binding name="AgentServiceSoapBinding" type="impl:AgentService"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> - <wsdl:operation name="totalForList"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="totalForListRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="totalForListResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="list"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="listRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="listResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="find"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="findRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="findResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="save"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="saveRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="saveResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="update"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="updateRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="updateResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="delete"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="deleteRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="deleteResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="listAgentGroup"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="listAgentGroupRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="listAgentGroupResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> - <wsdl:operation name="loadAgentInfoForTelBar"> <wsdlsoap:operation soapAction="" /> - <wsdl:input name="loadAgentInfoForTelBarRequest"> <wsdlsoap:body use="literal" /> </wsdl:input> - <wsdl:output name="loadAgentInfoForTelBarResponse"> <wsdlsoap:body use="literal" /> </wsdl:output> - <wsdl:fault name="ServiceException"> <wsdlsoap:fault name="ServiceException" use="literal" /> </wsdl:fault> </wsdl:operation> </wsdl:binding> - <wsdl:service name="AgentWs"> - <wsdl:port binding="impl:AgentServiceSoapBinding" name="AgentService"> <wsdlsoap:address location="http://123.150.148.30:8020/cin-cc-ws/services/AgentService" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
要调用的方法:listAgentGroup 代码如下:
String url = "http://123.145.148.29:8020/cin-cc-ws/services/AgentService?wsdl"; String namespace = "http://cintel.com/ws/cc/wsdl/v1_0/agent/service"; String actionUri = "listAgentGroup"; String op = "listAgentGroup"; Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(url)); org.apache.axis.description.OperationDesc oper; org.apache.axis.description.ParameterDesc param; oper = new org.apache.axis.description.OperationDesc(); param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("agentId"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema"), java.lang.String.class, false, false); param.setOmittable(true); oper.addParameter(param); oper.addParameter(param); oper.setReturnClass(String.class); call.setUseSOAPAction(true); call.setSOAPActionURI(namespace + actionUri); call.setOperationName(new QName(namespace, op)); Object[] params = new Object[] {"1001"}; String result = (String)call.invoke(params);
由于第二个参数是一个自定义的类型,返回也是一个自定义的类型。此处试了多种加入参数的方法也不行。
不要说小弟吝啬,小弟把所有积分都拿出来了。
相关推荐
Java和Axis2是开发Web服务客户端的重要工具,用于调用基于SOAP协议的Web服务。本文将深入探讨如何利用Java和Axis2库来实现这一功能,同时结合提供的代码示例进行详细解析。 首先,Web服务是一种通过网络进行通信的...
Java Axis 直接调用webservice 接口工具类, 无需根据wsdl编译客户端,需要axis相关包,测试使用axis 1.4, 附demo引入axis包后直接可以测试;
标题“myService_purpose1sv_cxf调用axis2的接口服务_接口服务_”暗示了一个名为“myService”的具体服务示例,这个服务利用CXF来调用Axis2实现的接口。"purpose1sv"可能是项目或功能的特定标识符,但没有足够的上...
标题中的“Java通过Axis调用天气预报的WebService”是指使用Java编程语言,通过Apache Axis库来访问和使用公开的天气预报Web服务。Apache Axis是一个开放源码的SOAP(简单对象访问协议)工具包,它允许开发者创建和...
1. **创建WebService**:在Axis2中,可以通过编写一个简单的Java类并暴露其方法作为Web服务接口。这个类通常会遵循SOAP协议,定义服务操作。例如,你可以创建一个名为`HelloWorldService`的类,包含一个`sayHello`...
在Java开发中,调用HTTPS发布的Web Service接口是一项常见的任务,尤其在企业级应用中,HTTPS提供了安全的数据传输。本文将详细介绍如何使用Apache Axis库来实现这一功能,并提供相关步骤和注意事项。 首先,理解...
本文将深入探讨如何使用CXF客户端调用Axis服务端的流程。 ### 一、了解CXF和Axis **CXF**(CXF: Composite eXtensible Framework)是一个开源的Java Web服务框架,它提供了多种方式来创建和使用Web服务,包括JAX-...
以下是如何使用Axis进行Java调用WebService接口的步骤: 1. **创建WebService客户端**: 首先,你需要获取服务的WSDL文档。这是一个XML文件,描述了服务的接口、操作和消息格式。你可以通过URL获取WSDL,或者如果...
### Java WebService 简单实例 方式二(axis1直接调用方式) #### 背景介绍 在软件开发领域,特别是在企业级应用中,Web服务作为一种标准的技术规范被广泛采用,它允许不同系统间进行通信与数据交换。Java Web ...
本教程将深入探讨如何使用Axis库来实现在Java中调用WebService接口。Axis是一个开源的Java SOAP栈,它提供了从Java代码中创建和消费Web服务的能力。 **一、什么是WebService?** WebService是一种基于XML的协议,它...
标题“Axis2教程和java调用webservice的各种方法总结”表明了本文档主要聚焦于两个核心内容:一是Axis2框架的使用教程,二是Java语言调用Web服务的不同方法的综合概述。 描述中的“Axis2教程”暗示了会详细讲解Axis...
本文将深入探讨如何使用Java调用WebService接口,以实例分析有参方法Add的使用技巧。 首先,我们需要了解WebService的基础知识。WebService是一种基于开放标准(如SOAP、WSDL和UDDI)的Web应用程序,它能够通过HTTP...
本人是做java开发,所以想研究一下怎么用java开发webservice供delphi7调用 javaserver 是WebService 服务端,采用AXIS 1.4 为什么采用AXIS1.4? 因为经过我测试,Delphi7版本太老了,不兼容JAX-WS和AXIS2 另外我...
Java调用WebService是Web服务交互的一种常见方式,而Axis2是一个高效的、可扩展的Web服务框架,它在Java世界中广泛用于创建和消费Web服务。本文将深入探讨使用Axis2.jar包来调用WebService的相关知识点。 一、Axis2...
本方法是用axis1.4技术,实现java客户端调用webservice。已经可实现过可行的,如果不行可加我QQ号302633进行详细解析。
它允许开发者通过Java调用第三方提供的Webservice,使得不同系统间的数据交换变得简单。本文将详细介绍如何使用Java Axis调用第三方Webservice,并提供一个简单的示例。 一、Java Axis调用第三方Webservice的准备...
本文将详细解析如何通过Apache Axis库在Java应用中调用WebService,具体聚焦于“JAVA调用webservice(axis方式)”这一主题。 ### Apache Axis简介 Apache Axis是一个开源的Java Web服务框架,支持SOAP协议,用于...
Web服务接口通常是基于SOAP(Simple Object Access Protocol)或REST(Representational State Transfer)协议,而本主题主要关注使用Java调用基于SOAP的Web服务接口。"Java调用Webservice接口的jar包"描述的可能是...