呼び出す必要のあるWebサービスのこの構造が与えられました。wsの名前はSet_Detailsです。エラーが発生しないように、正しく理解しました。これを解決する方法がわかりません。私がそれを呼ぶとき、私はエラーを得ました:
System.InvalidOperationException:Set_DetailsWebサービスのメソッド名が無効です。System.Web.Services.Protocols.HttpServerProtocol.Initialize()at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type、HttpContext context、HttpRequest request、HttpResponse response)atSystem.Web.Services.Protocols.ServerProtocolFactory。 Create(Type type、HttpContext context、HttpRequest request、HttpResponse response、Boolean&abortProcessing)
*実際のURLパスを偽のアドレスに変更したので、URLを無視してください
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Set_Details xmlns="http://ws.blobobobo.uk/WebService/">
<Details>
<Number>int</Number>
<Category>string</Category>
</Details>
<LoginID>string</LoginID>
<LoginPassword>string</LoginPassword>
</Set_Details>
</soap:Body>
</soap:Envelope>
これは、クラスWebサービスを呼び出す私のコードです
dim ws
set ws = new webservice
ws.url = mainip
ws.method = "Set_OrderDetails"
ws.parameters.Add "Number", "6166""
ws.parameters.Add "Category", "ffff"
ws.parameters.Add "LoginID", "ex10"
ws.parameters.Add "LoginPassword", "ex20"
ws.execute
response.write ws.response
set ws = nothing
これは、Webサービスを代表する私のクラスです
class WebService
public Url
public Method
public Response
public Parameters
public function execute()
dim xmlhttp
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "POST", Url & "/" & Method, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send Parameters.toString
response = xmlhttp.responseText
set xmlhttp = nothing
end function
Private Sub Class_Initialize()
Set Parameters = new wsParameters
End Sub
Private Sub Class_Terminate()
Set Parameters = Nothing
End Sub
end class
class wsParameters
public mCol
public function toString()
dim nItem
dim buffer
buffer = ""
for nItem = 1 to Count
buffer = buffer & Item(nItem).toString & "&"
next
if right(buffer,1)="&" then
buffer = left(buffer,len(buffer)-1)
end if
toString = buffer
end function
public sub Clear
set mcol = nothing
Set mCol = CreateObject("Scripting.Dictionary")
end sub
public sub Add(pKey,pValue)
dim newParameter
set newParameter = new wsParameter
newParameter.Key = pKey
newParameter.Value = pValue
mCol.Add mCol.count+1, newParameter
set newParameter = nothing
end sub
public function Item(nKey)
set Item=mCol.Item(nKey)
end function
public function ExistsXKey(pKey)
dim nItem
for nItem = 1 to mcol.count
if mCol.Item(nItem).key = pKey then
ExistsXKeyword = true
exit for
end if
next
end function
public sub Remove(nKey)
mCol.Remove(nKey)
end sub
public function Count()
Count=mCol.count
end function
Private Sub Class_Initialize()
Set mCol = CreateObject("Scripting.Dictionary")
End Sub
Private Sub Class_Terminate()
Set mCol = Nothing
End Sub
end class
class wsParameter
public Key
public Value
public function toString()
toString = Key & "=" & Value
end function
end class
Dim ip
mainip="http://ws.bloblobo.uk/WebServices/ws.asmx"