经典的asp和Web服务-如何使其与java一起工作?
我已经接管了一个用经典ASP编写的旧应用程序,它使用两个不同的Web服务发布和接收来自的响应 Web服务A是在ASP中完成的。它在IE和Chrome中都能正常工作 Web服务B也是在ASP中完成的。它在IE中运行良好,在Chrome中无响应。我在Java中重新做了,但在IE中它会给出一个结果,而在Chrome中什么都不会发生。Webservice B也在响应时调用Webservice 我真的希望webservice在两种浏览器中都能工作,没有弹出的警告,因为随着时间的推移,弹出的警告会变得非常烦人 我做错了什么?我不明白为什么服务A工作得很好,但B不行 Webservice A经典的asp和Web服务-如何使其与java一起工作?,java,web-services,soap,asp-classic,xmlhttprequest,Java,Web Services,Soap,Asp Classic,Xmlhttprequest,我已经接管了一个用经典ASP编写的旧应用程序,它使用两个不同的Web服务发布和接收来自的响应 Web服务A是在ASP中完成的。它在IE和Chrome中都能正常工作 Web服务B也是在ASP中完成的。它在IE中运行良好,在Chrome中无响应。我在Java中重新做了,但在IE中它会给出一个结果,而在Chrome中什么都不会发生。Webservice B也在响应时调用Webservice 我真的希望webservice在两种浏览器中都能工作,没有弹出的警告,因为随着时间的推移,弹出的警告会变得非常烦
Set oXmlHTTP = CreateObject("Microsoft.XMLHTTP")
oXmlHTTP.Open "POST", "http://serviceA?wsdl", False
oXmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
oXmlHTTP.setRequestHeader "SOAPAction", "urn:requestA"
SOAPRequest = [XMLRequest]
On Error Resume Next
oXmlHTTP.send SOAPRequest
If Err.Number Then
'Do something
Err.Clear
Else
SOAPResponse = oXmlHTTP.responseXML.text
End If
On Error Goto 0
If LEN(SOAPResponse) > 0 Then
Set objxml = Server.CreateObject("MSXML2.DOMDocument")
objxml.async = False
objxml.load (oXmlHTTP.responseXML)
If objxml.parseError.errorCode <> 0 Then
'handle the error
End If
Set nodeList = objxml.getElementsByTagName("TagName")
SizeofObject = nodeList.length-1
For i = 0 To (SizeofObject)
'get individual element
Next
Set oXmlHTTP = nothing
SOAPRequest = ""
SOAPResponse = ""
Set-oXmlHTTP=CreateObject(“Microsoft.XMLHTTP”)
oXmlHTTP.打开“POST”http://serviceA?wsdl”“错
oXmlHTTP.setRequestHeader“内容类型”,“文本/xml;字符集=utf-8”
oXmlHTTP.setRequestHeader“SOAPAction”,“urn:requestA”
SOAPRequest=[XMLRequest]
出错时继续下一步
oXmlHTTP.send SOAPRequest
如果有错误,那么
“做点什么
呃,明白了
其他的
SOAPResponse=oXmlHTTP.responseXML.text
如果结束
错误转到0
如果LEN(SOAPResponse)>0,则
设置objxml=Server.CreateObject(“MSXML2.DOMDocument”)
objxml.async=False
objxml.load(oXmlHTTP.responseXML)
如果objxml.parseError.errorCode为0,则
“处理错误
如果结束
Set nodeList=objxml.getElementsByTagName(“标记名”)
SizeofObject=nodeList.length-1
对于i=0到(SizeofObject)
'获取单个元素
下一个
设置oXmlHTTP=nothing
SOAPRequest=“”
SOAPResponse=“”
Webservice B
Set oXmlHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
oXmlHTTP.open "POST", "http://serviceB?wsdl", False
oXmlHTTP.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"
SOAPRequest = [XMLRequest]
On Error Resume Next
oXmlHTTP.send SOAPRequest
If Err.Number Then
'Handle error
Err.Clear
Else
SOAPResponse = oXmlHTTP.responseText
End If
On Error Goto 0
if len(SOAPResponse) > 0 then
Set objxml = Server.CreateObject("MSXML2.DOMDocument")
objxml.async = False
objxml.load (oXmlHTTP.responseXML)
If objxml.parseError.errorCode <> 0 Then
'handle the error
End If
Set nodeList = objxml.getElementsByTagName("TagB1")
SizeofObject = nodeList.length-1
For i = 0 To (SizeofObject)
'get individual elements
array(i) = nodeList.item(i).Text
Next
NextRequest(array)
else
'handle empty
end if
Set oXmlHTTP = nothing
SOAPRequest = ""
SOAPResponse = ""
Function NextRequest(inputArray())
If UBound(inputArray)>=0 Then
For Each ele In inputArray
Set oXmlHTTP2 = CreateObject("MSXML2.ServerXMLHTTP.3.0")
oXmlHTTP2.Open "POST", "http://serviceB?wsdl", False
oXmlHTTP2.setRequestHeader "Content-Type", "text/xml; charset=UTF-8"
SOAPRequest2 =[XMLRequest2]
On Error Resume Next
oXmlHTTP2.send SOAPRequest2
If Err.Number Then
'Handle
Err.Clear
Else
SOAPResponse2 = oXmlHTTP2.responseXML.text
End If
On Error Goto 0
If Len(SOAPResponse2) > 0 then
Set objxml2 = Server.CreateObject("MSXML2.DOMDocument")
objxml2.async = False
objxml2.load (oXmlHTTP2.responseXML)
'Fejlhåndtering af XML
If objxml2.parseError.errorCode <> 0 Then
'handle the error
End If
Set nodeList = objxml2.getElementsByTagName("Tag2")
SizeofObject = nodeList.length-1
For j = 0 To SizeofObject
Response.Write objxml2.getElementsByTagName("Tag2").item(j).Text
Next
End If
Next
Set oXmlHTTP2 = nothing
SOAPRequest2 = ""
SOAPResponse2 = ""
End Function
Set-oXmlHTTP=CreateObject(“MSXML2.ServerXMLHTTP.3.0”)
oXmlHTTP.open“POST”http://serviceB?wsdl”“错
oXmlHTTP.setRequestHeader“内容类型”,“文本/xml;字符集=UTF-8”
SOAPRequest=[XMLRequest]
出错时继续下一步
oXmlHTTP.send SOAPRequest
如果有错误,那么
'处理错误
呃,明白了
其他的
SOAPResponse=oXmlHTTP.responseText
如果结束
错误转到0
如果len(SOAPResponse)>0,则
设置objxml=Server.CreateObject(“MSXML2.DOMDocument”)
objxml.async=False
objxml.load(oXmlHTTP.responseXML)
如果objxml.parseError.errorCode为0,则
“处理错误
如果结束
Set nodeList=objxml.getElementsByTagName(“TagB1”)
SizeofObject=nodeList.length-1
对于i=0到(SizeofObject)
'获取单个元素
数组(i)=节点列表项(i).文本
下一个
NextRequest(阵列)
其他的
“把手空着
如果结束
设置oXmlHTTP=nothing
SOAPRequest=“”
SOAPResponse=“”
函数NextRequest(inputArray())
如果UBound(inputArray)>=0,则
对于输入阵列中的每个元素
设置oXmlHTTP2=CreateObject(“MSXML2.ServerXMLHTTP.3.0”)
oXmlHTTP2.打开“POST”http://serviceB?wsdl”“错
oXmlHTTP2.setRequestHeader“内容类型”,“文本/xml;字符集=UTF-8”
SOAPRequest2=[XMLRequest2]
出错时继续下一步
oXmlHTTP2.send SOAPRequest2
如果有错误,那么
“把手
呃,明白了
其他的
SOAPResponse2=oXmlHTTP2.responseXML.text
如果结束
错误转到0
如果Len(SOAPResponse2)>0,则
设置objxml2=Server.CreateObject(“MSXML2.DOMDocument”)
objxml2.async=False
objxml2.load(oXmlHTTP2.responseXML)
“Fejlhåndering af XML
如果objxml2.parseError.errorCode为0,则
“处理错误
如果结束
Set nodeList=objxml2.getElementsByTagName(“Tag2”)
SizeofObject=nodeList.length-1
对于j=0到SizeOffObject
Response.Write objxml2.getElementsByTagName(“Tag2”).item(j).Text
下一个
如果结束
下一个
设置oXmlHTTP2=无
SOAPRequest2=“”
SOAPResponse2=“”
端函数
Javascript标记是一个Java标记??是的,我现在已经更正了您的评论“处理错误,但您没有做任何事情”。第一步是“处理”错误并找出它到底是什么。我注意到您在同一个脚本中使用不同版本的msxml,这有时会导致问题。我建议您始终使用最新的一个,即:Server.CreateObject(“MSXML2.DOMDocument.6.0”)
和Server.CreateObject(“MSXML2.ServerXMLHTTP.6.0”)
,可能是因为您在Webservice B上缺少SOAPAction
请求头?