VB에서 웹서비스 이용하기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
Option Explicit Private Sub Command1_Click() Const HttpPath = "http://111.111.111.111/service.asmx/Doc" Dim xmlDoc As Object Dim strRequest As String Dim XMLhttp As MSXML2.XMLHTTP30 Dim sSend Set XMLhttp = New MSXML2.XMLHTTP30 sSend = "RLOC=" & Me.Text1.Text XMLhttp.open "POST", HttpPath, False XMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" XMLhttp.send sSend Me.Text2 = XMLhttp.responseText Me.Text2 = response Dim doc As DOMDocument Set doc = New DOMDocument '동적메모리 설정 Dim objNodeList As IXMLDOMNodeList doc.async = False doc.loadXML (response) Set objNodeList = doc.getElementsByTagName("Root") If objNodeList.length Then Me.Text3 = Me.Text3 & objNodeList.Item(0).selectSingleNode("Name").nodeTypedValue & ", " Me.Text3 = Me.Text3 & objNodeList.Item(0).selectSingleNode("age").nodeTypedValue & ", " Me.Text3 = Me.Text3 & objNodeList.Item(0).selectSingleNode("address").nodeTypedValue & ", " Me.Text3 = Me.Text3 & objNodeList.Item(0).selectSingleNode("phonnumber").nodeTypedValue & ", " End If End Sub |
ASP에서 웹서비스 이용하기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<% Dim ServerType Dim ServiceName Dim SoapRequest: ServerType = request.Form("ServerType") ServiceName = request.Form("ServiceName") SoapRequest = request.Form("SoapRequest") HttpPath="http://uapi.test.com/API" '------------------------------------------------------------------- Dim lResolve Dim lConnect Dim lSend Dim lReceive Dim sSend sSend="ServerType="& ServerType & _ "&ServiceName="& ServiceName & _ "&SoapRequest="& SoapRequest Set XMLhttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0") lResolve = 60 * 1000 'Timeout values are in milli-seconds lConnect = 60 * 1000 lSend = 60 * 1000 lReceive = 60 * 1000 XMLhttp.setTimeouts lResolve, lConnect, lSend, lReceive XMLhttp.open "POST",HttpPath, False '------------------------------------------------------------------ XMLhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" XMLhttp.Send sSend Dim sResponse sResponse = XMLhttp.responseText Response.ContentType = "text/xml" response.write sResponse response.end %> |
오류 : 시스템이 지정한 인코딩을 지원하지 않습니다.=> MSXML 4.0 SP2 파서가 설치 되지 않음
msxmlkor.msi 설치
다운로드 : https://www.microsoft.com/ko-kr/download/confirmation.aspx?id=19662