VS 2010 と VB.NET を使用して Web アプリケーション (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