【问题标题】:SOAP WCF Service Call From a .NET Console Application来自 .NET 控制台应用程序的 SOAP WCF 服务调用
【发布时间】:2018-02-05 14:14:28
【问题描述】:

我有一个 SOAP WCF 服务地址,我想从我的控制台应用程序访问它。

我已将此服务从服务参考添加到我的控制台项目中,这会生成如下配置文件

<system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="ZINTWS0018binding">
                    <mtomMessageEncoding messageVersion="Soap11WSAddressing10" />
                    <httpsTransport authenticationScheme="Basic" />
                </binding>
                <binding name="ZINTWS0018binding_SOAP12">
                    <mtomMessageEncoding />
                    <httpsTransport authenticationScheme="Basic" />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://34sapqa6.arkas.com:8000/sap/bc/srt/rfc/sap/zintws0018/120/zintws0018service/zintws0018binding"
                binding="customBinding" bindingConfiguration="ZINTWS0018binding"
                contract="SAPServiceRef.ZINTWS0018" name="ZINTWS0018binding" />
            <endpoint address="http://34sapqa6.arkas.com:8000/sap/bc/srt/rfc/sap/zintws0018/120/zintws0018service/zintws0018binding"
                binding="customBinding" bindingConfiguration="ZINTWS0018binding_SOAP12"
                contract="SAPServiceRef.ZINTWS0018" name="ZINTWS0018binding_SOAP12" />
        </client>
    </system.serviceModel>

我已经分配了用户名和密码;

client.ClientCredentials.UserName.UserName = "***";
client.ClientCredentials.UserName.Password = "***";

当我尝试访问此服务时,我收到如下错误;

你有什么建议吗?我在哪一点做错了? 谢谢。

{"The content type text/xml of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;wsdl:definitions targetNamespace=\"urn:sap-com:document:sap:soap:functions:mc-style\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:wsoap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" xmlns:tns=\"urn:sap-com:document:sap:soap:functions:mc-style\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:n1=\"urn:sap-com:document:sap:rfc:functions\"&gt;&lt;wsdl:documentation&gt;&lt;sidl:sidl xmlns:sidl=\"http://www.sap.com/2007/03/sidl\"/&gt;&lt;/wsdl:documentation&gt;&lt;wsp:UsingPolicy wsdl:required=\"true\"/&gt;&lt;wsp:Policy wsu:Id=\"BN_BN_ZINTWS0018binding\"&gt;&lt;saptrnbnd:OptimizedXMLTransfer uri=\"http://xml.sap.com/2006/11/esi/esp/binxml\" xmlns:saptrnbnd=\"http://www.sap.com/webas/710/soap/features/transportbinding'."}

【问题讨论】:

    标签: xml web-services wcf soap wsdl


    【解决方案1】:

    请检查您是否可以在浏览器中访问该地址。如果不是,那么这可能表明存在问题......

    【讨论】:

    • 是的,我通过 SOAPUI 检查地址时可以访问该地址
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-07
    • 1970-01-01
    相关资源
    最近更新 更多