在java客户端调用C++ GSoap生成的webservice
C++通过 GSoap生成的wsdl文件如下
<?xml version="1.0" encoding="UTF-8"?> <definitions name="Service" targetNamespace="http://tempuri.org/ns.xsd/Service.wsdl" xmlns:tns="http://tempuri.org/ns.xsd/Service.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:ns="http://tempuri.org/ns.xsd" 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://tempuri.org/ns.xsd" 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:ns="http://tempuri.org/ns.xsd" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <!-- operation request element --> <element name="T10003"> <complexType> <sequence> <element name="a" type="xsd:double" minOccurs="1" maxOccurs="1"/><!-- ns__T10003::a --> <element name="b" type="xsd:double" minOccurs="1" maxOccurs="1"/><!-- ns__T10003::b --> </sequence> </complexType> </element> <!-- operation response element --> <element name="T10003Response"> <complexType> <sequence> <element name="result" type="xsd:double" minOccurs="0" maxOccurs="1" nillable="true"/><!-- ns__T10003::result --> </sequence> </complexType> </element> </schema> </types> <message name="T10003Request"> <part name="parameters" element="ns:T10003"/><!-- ns__T10003::ns__T10003 --> </message> <message name="T10003Response"> <part name="parameters" element="ns:T10003Response"/> </message> <portType name="ServicePortType"> <operation name="T10003"> <documentation>Service definition of function ns__T10003</documentation> <input message="tns:T10003Request"/> <output message="tns:T10003Response"/> </operation> </portType> <binding name="Service" type="tns:ServicePortType"> <SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="T10003"> <SOAP:operation soapAction=""/> <input> <SOAP:body parts="parameters" use="literal"/> </input> <output> <SOAP:body parts="parameters" use="literal"/> </output> </operation> </binding> <service name="Service"> <documentation>gSOAP 2.8.14 generated service definition</documentation> <port name="Service" binding="tns:Service"> <SOAP:address location="http://localhost:80"/> </port> </service> </definitions>
在java端始终报错如下
2014-3-26 17:02:39 org.codehaus.xfire.transport.http.HttpChannel sendViaClient
严重: java.net.ConnectException: Connection refused: connect
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.
org.codehaus.xfire.fault.XFireFault: Couldn't send message.
at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:30)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy8.t10003(Unknown Source)
我怀疑是路径问题,请问在C++服务器端生成wsdl时,路径应该如何配置?
谢谢。。。。。。。。
相关推荐
C++做客户端,通过gSoap调用webservice,所调用的webservice方法返回的是自定义实体类,如果返回int,String等基本数据类型,这很容易实现;但这里函数返回的是List,Course,List甚至是Object,应该很有价值!
本文档主要介绍C++如何使用gSoap调用java的webservice接口. 是一篇自己工作中使用写下的使用说明。 非常详细步骤,带有简单示例的详细说明文档。
C++使用gsoap调用webservice接口,无需积分,仅供参考,内置说明文档,欢迎下载。
在VS2010下,使用C/C++通过gsoap调用webservice接口。 包含使用文档,C和C++调用实例。
VS2010使用c++、gSOAP调用WebService 图文教程 参考:http://blog.csdn.net/testcs_dn/article/details/51526051
C++做客户端,通过gSoap调用java发布的webservice,所调用的java方法返回的是自定义实体类,如果返回int,String等基本数据类型,这很容易实现;但这里函数返回的是List,Course,List甚至是Object,应该很有价值! ...
用C#编写客户端时,只需要将WebService添加到引用,就能像调用本地方法一样去C# WebService调用。像这样的例子也比比皆是,在这就不多讲。 二、用C++实现WebService,一般会用到gsoap,具体方法见:...
代码在Linux5.6 64下编译通过,代码中调用http://www.cs.fsu.edu/~engelen/calc.wsdl提供的WebService接口。文件中相应的文件由gSOAP工具生成,详细操作说明请看我的博客。
c++通过gsoap调用webservices实例
gSOAP编译工具提供了一个SOAP/XML 关于C/C++ 语言的实现,从而让C/C++语言开发web服务或客户端程序的工作变得轻松了很多。绝大多数的C++web服务工具包提供一组API函数类库来处理特定的SOAP数据结构,这样就使得用户...
基于gSOAP编译工具的C++客户端调用C#服务器端WebService示例程序; gSOAP编译工具使用说明文档; gsoap_win32_2.7.6c压缩包
lua实现webservice调用 通过gsoap 实现 C/C++ 调用web service
使用gSoap webservice C++客户端调用java 用axis写成的webservices服务端,实现简单功能(加发,乘法,随机数...),使用gsoap的同学可以查看
VS2015 C++和C++的通过SOAP的WebService,C++和C#的WebService发布和调用
我们已经知道如何在java端调用web服务(见web服务使用说明文档),但是如何在其他平台的其他客户端调用我们的web服务呢?下面做一下简单介绍并通过Gsoap举一个请求服务的例子。 WebService是一种跨平台的解决方案。...
界面用Qt,调用天气预报Webservice用gsoap,运行环境window
这是一个完整的工程,可以直接运行,内容包括: 里面有个C#做WebService服务DLL,用C++调用这个C#的DLL,以实现,C++在使用WebService时,总是用GSOAP这种麻烦的东西搞来搞去。
使用gsoap命令行生成代理的方式进行webservice的访问。但在使用中存在一些问题,比如中文乱码、调用接口方式存在代码冗余(实现每个接口都要进行参数初始化、代理初始化及接口调用、结果判断及返回)、实例对象会被...