td> tr> table> form>
Example: How to call the service to generate 18-bit key values
Related Documents: Use VBScript script to call Web services
Adjustment method (SOAP mode)
<% DIM URL, XMLHTTP, DOM, NODE, XMLDoc 'constructs different SOAP RequestSoApRequest = "according to the WebService test page."
"& _"
"
"& _
"
"& _
"
311
"& _
"
"& _
"
"& _" "URL =" http://www.ydcom.net/service/s_comm.asmx?methodname=getczid"set xmldoc = server.createObject ("msxml.domdocument") xmldoc.loadXML (SOAPREQUEST) SET XMLHTTP = server.CreateObject ( "Msxml2.XMLHTTP") xmlhttp.Open "POST", url, falsexmlhttp.setRequestHeader "Content-Type", "text / xml; charset = utf-8" xmlhttp.setRequestHeader "SOAPAction", "http: / /www.ydcom.net/service/SrvCOMM/S_COMM/GetCZID"xmlhttp.setRequestHeader "Content-Length", LEN (SoapRequest) xmlhttp.Send (xmlDOC) If xmlhttp.Status = 200 ThenxmlDOC.load (xmlhttp.responseXML) Response. Write xmlhttp.Status & "" Response.Write xmlhttp.StatusText & "Implementation of the results:" Response.Write xmlDOC.getElementsByTagName ( "GetCZIDResult") (0) .textelseResponse.Write xmlhttp.Status & "" Response.Write xmlhttp.StatusTextend if%>
Example: How to use the ASP call service to generate 18-bit key value ASP source file code
Description: In general, use WebService list description to construct different SOAPREQUEST, then return to XMLDoc.getElementsBytagname from return to XMLDOC
Adjustment method (HTTP mode)
<% Set objHTTP = Server.CreateObject ( "MSXML2.XMLHTTP") Set xmlDOC = Server.CreateObject ( "MSXML.DOMDocument") strWebserviceURL = "http://www.ydcom.net/service/S_COMM.asmx/GetCZID" ' Setting parameters and its value strRequest = "stypenum = 311" Objhttp.open "post", strWebserviceURL, FALSE 'Set this Content-Type is important objhttp.setrequestHeader "Content-Type", "Application / X-WWW-FORM-URLENCODED" objHTTP.SetRequestHeader ( "Content-Length: 30") objHTTP.Send (strRequest) bOK = xmlDOC.load (objHTTP.responseXML) 'state value to see if objHTTP.Status = 200 then xmlStr = xmlDOC.xmlResponse.Write xmlStrelseResponse.Write Objhttp.statu & "Response.Write Objhttp.Statustextend IF%> Instance: How to use ASP call service to generate 18-bit key value ASP source file code
VB6 calling method
DIM STRXML AS STRINGDIM STR AS STRINGSTR = TEXT2.TEXT 'Defines SOAP Message Strxml = "
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 / '>
& str & strows
"
"'Defines an HTTP object, send a POST message DIM H AS MSXML2.ServerXmlhttp40' to the server," Defines handwritten or accepted XML content to XML object DIM X as msxml2.domdocument40 'Initializing XML object set X = new msxml2.domDocument40 'converts handwritten SOAP string to XML object x.loadxml strXml' Initializing HTTP object set h = new msxml2.serverxmlhttp40 'Send a Post message to the specified URL H.Open "POST", "HTTP: //localhost/testwebservice/service1.asmx ", falseh.setRequestHeader" Content-Type "," text / XML "H.send (strXML) While H.ReadyState <> 4Wend 'Display returned XML information text1.text = h. ResponseText 'resolves the returned XML information and displays the return value set x = new msxml2.domdocument40X.LoadXML text1.textText1.text = x.childNodes (1) .TextVB.net calling method
1, first add web reference, address: http://www.ydcom.net/service/s_comm.asmx
2. Definition: DIM SCOM AS New Net.ydcom.www.s_comm
3, call: DIM STRCZID AS STRING = Scomm.getCzid ("313")
Example: How to use the VB.NET call service to generate 18-bit key value vb.net source file code
Calling method in PB.NET (PB9)
SoapConnection conn Test_wsservice1soap sComlong rVal // string str_endpoint // str_endpoint = "http://www.ydcom.net/service/s_comm.asmx?WSDL" conn = create SoapConnection rVal = Conn.CreateInstance (sCom, "test_wsservice1soap") sle_1. Text = scom.getczid ("313")) DESTROY CONN
转载请注明原文地址:https://www.9cbs.com/read-127728.html
|