当前位置: 代码迷 >> C# >> 用WCF写得webservice发布后,JAVA不能调用,该如何解决
  详细解决方案

用WCF写得webservice发布后,JAVA不能调用,该如何解决

热度:414   发布时间:2016-05-05 04:41:19.0
用WCF写得webservice发布后,JAVA不能调用
<?xml version="1.0"?>
<configuration>
    <system.serviceModel>
      <bindings>
        <basicHttpBinding>
          <binding name="wumanBinding1" maxReceivedMessageSize="2000000" transferMode="Streamed" sendTimeout="08:00:00" receiveTimeout="08:00:00"/>

        </basicHttpBinding>
        <netTcpBinding>
          <binding name="wumanBinding2" transferMode="Streamed" maxReceivedMessageSize="2000000" sendTimeout="08:00:00" receiveTimeout="08:00:00"/>
        </netTcpBinding>
      </bindings>
      <behaviors>
        <serviceBehaviors>
          <behavior name="GateWayBehaviors">
            <!-- 为避免泄漏元数据信息,


          请在部署前将以下值设置为 false 并删除上面的元数据终结点  -->
            <serviceMetadata httpGetEnabled="true"/>
            <!-- 要接收故障异常详细信息以进行调试,


          请将以下值设置为 true。在部署前设置为 false 
            以避免泄漏异常信息-->
            <serviceDebug includeExceptionDetailInFaults="true"/>
            <serviceThrottling maxConcurrentCalls="200" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
          </behavior>
        </serviceBehaviors>
      </behaviors>
      <services>
        <service name="GateWayService.GateWayService" behaviorConfiguration="GateWayBehaviors">
          <endpoint address="" binding="basicHttpBinding" contract="GateWayService.IGateWayService">
            <identity>
              <dns value="192.168.40.128"/>
            </identity>
          </endpoint>
          <host>
            <baseAddresses>
              <add baseAddress="http://192.168.40.128:9012/GateWayService"/>
            </baseAddresses>
          </host>
        </service>
      </services>
    </system.serviceModel>
</configuration>
以上为发布的脚本,请高人看看有没有问题?
在IE里输入http://192.168.40.128:9012/GateWayService?wsdl,能正常显示

 <?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions name="GateWayService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd0" namespace="http://tempuri.org/" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/GateWayService" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd4" namespace="http://schemas.microsoft.com/Message" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd5" namespace="http://schemas.datacontract.org/2004/07/GateWayService.Modal" /> 
  <xsd:import schemaLocation="http://192.168.40.128:9012/GateWayService?xsd=xsd6" namespace="http://schemas.datacontract.org/2004/07/System.Data" /> 
  </xsd:schema>
  </wsdl:types>
。。。。。

- <wsdl:input>
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
- <wsdl:operation name="GetDBTable">
  <soap:operation soapAction="http://tempuri.org/IGateWayService/GetDBTable" style="document" /> 
- <wsdl:input>
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="GateWayService">
- <wsdl:port name="BasicHttpBinding_IGateWayService" binding="tns:BasicHttpBinding_IGateWayService">
  <soap:address location="http://192.168.40.128:9012/GateWayService" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
谢谢回复

------解决思路----------------------

如果返回的是C#的实体或DataTable这类的东西,基本是无法还原出实体的。
你只能去解析他里面的XML数据,如果只是平常的类型,那也要解析XML数据。
------解决思路----------------------
你这有什么看的..

不过C#能调用证明你的接口没错啊.

是不是java语言太弱了 根本调用不了webservice呢?


------解决思路----------------------
通过xml肯定能调用,如果是通过类似vs的添加引用方式,有些特定的东西比如DataTable java是支持不了的
------解决思路----------------------
应该不会出现java调用不了的问题,你说的java不能调用具体是什么情况?
------解决思路----------------------
反悔json,xml吧。。。别返回c#特有的
  相关解决方案