有一个带有配置的 WCF 服务:
<services>
<service name="MyService" behaviorConfiguration="MyServiceBehavior">
<endpoint
binding="basicHttpBinding"
contract="IMyService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8001/MyService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
该脚本应该调用它:
Option Explicit
Dim soapClient
Dim serviceUri
Dim serviceName
Dim portName
Dim result
serviceUri = "http://localhost:8001/MyService"
serviceName = "MyService"
portName = "BasicHttpBinding_IMyService"
Set soapClient = CreateObject("MSSOAP.soapClient")
soapClient.ClientProperty("ServerHTTPRequest") = True
soapClient.mssoapinit serviceUri & "?WSDL", serviceName, portName
运行脚本时出现此错误:
客户端:WSDLReader:分析 WSDL 文件失败 HRESULT=0x8 0004005 - WSDLReader:初始化服务失败 HRESULT=0x80004005 - WSDL 服务:初始化服务 MyService 的端口失败 HRESULT =0x80004005 - WSDLPort:分析端口 BasicHttpBinding_IMyService 的绑定信息失败 HRESULT =0x80004005 - WSDLPort: 端口 BasicHttpBinding_IMyService 的操作无法初始化 HRESULT=0x8000 4005 - WSDLOperation: 操作 //def:portType[@name="IMyService"]/def:operation[@name="MyMethod"] 没有在 porttype 部分中找到 HRESULT=0x80004005
出了什么问题?请帮忙。
编辑:
谢谢你,芝士,你的回答。MSSOAP 的问题似乎在于它要求所有 xsd 模式都内嵌在生成的 WSDL 文件中。WCF 默认情况下不这样做。