Windows Server上未注册的SOAP Client 3.0

时间:2012-11-21 13:08:55

标签: asp.net vb.net soap soap-client

我使用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

1 个答案:

答案 0 :(得分:0)

该工具似乎有问题,您可能想要使用WCFTest客户端,它应该与您一起使用soap消息,这可以在VS2010文件夹中找到

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

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

更新

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

希望这有帮助。

干杯