0 0

java客户端调用C++ GSoap生成的webservice 10

在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时,路径应该如何配置?

谢谢。。。。。。。。

2014年3月26日 17:18

1个答案 按时间排序 按投票排序

0 0

请问这个问题解决了么,遇到了同样的问题

2016年3月15日 14:59

相关推荐

Global site tag (gtag.js) - Google Analytics