0

我使用 VS 2010 和 VB.NET 开发了一个 Web 应用程序(网站)。我能够从 VS 成功运行该应用程序。但是当我在我的托管服务器上发布并上传它时,会出现此错误消息。

Retrieving the COM class factory for component with CLSID {7F017F97-9257-11D5-87EA-00B0D0BE6479} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

我已经下载了 SOAP 工具包 3.0 并将其导入到我的应用程序参考中。这是我的代码:

Imports MSSOAPLib30


Dim objSoapClient As New SoapClient30             '=== Create an instance of SoapClient

            '=== Set Client Properties
            objSoapClient.ClientProperty("ServerHTTPRequest") = True

            '=== Retrieve KWMP web services WSDL
            Call objSoapClient.mssoapinit("https://example.com/ReferencePayment?WSDL", "ReferencePayment")
            '=== Set connection property to be over SSL
            objSoapClient.ConnectorProperty("UseSSL") = False

            '=== Now consume the web sevices according to KWMP Specification
            Dim output As String = objSoapClient.verifyTransaction(RCode, "00105952-129251")

--更新 -- 除了上面的方法,我正在考虑使用 POST web 方法来消费 SOAP XML。这是 WCF 测试客户端生成的 xml 请求:

  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none" />
   </s:Header>
   <s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <q1:verifyTransaction xmlns:q1="urn:Foo">
  <String_1 xsi:type="xsd:string">12345678901234567890</String_1>
  <String_2 xsi:type="xsd:string">00109902-129251</String_2>
</q1:verifyTransaction>
</s:Body>
</s:Envelope>

我有方法使用返回内部服务器错误 500 的 SOAP XML !!!!! 你认为哪一部分是错的?!

 Public Function ServiceCall(RefCode As String) As String
    Dim resultXml As String
    Dim wbrqst As WebRequest = WebRequest.Create("https://modern.enbank.net/ref-payment/ws/ReferencePayment?WSDL")
    Dim httpreq As HttpWebRequest = DirectCast(wbrqst, HttpWebRequest)
    httpreq.Method = "POST"
    httpreq.ContentType = "Content-Type: text/xml; charset=utf-8"
    httpreq.Headers.Add("SOAPAction", "https://modern.enbank.net/ref-payment/ws/ReferencePayment")
    'httpreq.Headers.Add("<Action s:" + "ReferencePayment>")
    httpreq.ProtocolVersion = HttpVersion.Version11
    httpreq.Credentials = CredentialCache.DefaultCredentials
    Dim requestStream As Stream = httpreq.GetRequestStream()
    Dim streamWriter As New StreamWriter(requestStream, Encoding.ASCII)
    Dim sb As New StringBuilder()
    sb.Append("<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>")
    sb.Append("<s:Body s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>")
    sb.Append("<q1:verifyTransaction xmlns:q1='urn:Foo'>")
    sb.Append("xml:xsd='http://www.w3.org/2001/XMLSchema'")
    sb.Append("<verifyTransaction xmlns='urn:Foo'")
    sb.Append("<String_1 xsi:type='xsd:string'>12345678901234567890</String_1>")
    sb.Append("<String_2 xsi:type='xsd:String'>00109902-129251</String_2>")
    sb.Append("</q1:verifyTransaction> </s:Body></s:Envelope>")
    streamWriter.Write(sb.ToString())
    streamWriter.Close()
    Dim wr As HttpWebResponse = DirectCast(httpreq.GetResponse(), HttpWebResponse)
    Dim srd As New StreamReader(wr.GetResponseStream())
    resultXml = srd.ReadToEnd()
    Return resultXml

End Function
4

1 回答 1

0

该工具似乎有问题,您可能想要使用 WCFTest Client,它应该与您的肥皂消息一起使用,这可以从 VS2010 文件夹中找到

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe

只需添加您要打开的服务,它就会为您即时创建客户端代理。

更新:

您可能希望使用添加 Web 引用并创建一个 Web 服务项目作为 VS 项目的一部分。

希望这可以帮助。

干杯

于 2012-11-21T13:17:55.253 回答