IntroductieVoorbeeld<% Dim objXmlHttp Dim objXmlHttp2 Dim strSessionId Dim strXml Dim strAccessKey Dim strAdministrationId Dim strWebserviceUrl Dim strJournalXml strAccessKey = "VERVANGEN MET WEBSERVICEACCESSKEY" strAdministrationId = "VERVANGEN MET ADMINISTRATIONID" strWebserviceUrl = "https://api.yukiworks.nl/ws/Accounting.asmx" ' Build SOAP XML message for WebServiceMethod "http://www.theyukicompany.com/Authenticate". strXml = "<?xml version=""1.0"" encoding=""utf-8""?>" & _ "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" & _ "<soap12:Body>" & _ "<Authenticate xmlns=""http://www.theyukicompany.com/"">" & _ "<accessKey>" & strAccessKey & "</accessKey>" & _ "</Authenticate>" & _ "</soap12:Body>" & _ "</soap12:Envelope>" ' Create ServerXMLHTTP object. Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objXmlHttp.open "POST", strWebserviceUrl, False objXmlHttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8" objXmlHttp.setRequestHeader "SOAPAction", "http://www.theyukicompany.com/Authenticate" objXmlHttp.setRequestHeader "Content-Length", Len(strXml) ' Send SOAP message. objXmlHttp.send strXml ' Print out the request status. Response.Write "WebServiceMethod ""Authenticate"" request status: <b>" & objXmlHttp.status & " " & objXmlHttp.statusText & "</b><br /><br />" ' Print out the SOAP XML response. Response.Write "<div style=""border: solid 1px black;"">" & Server.HTMLEncode(objXmlHttp.responseText) & "</div><br /><br />" ' Parse sessionKey from SOAP XML response with ActiveXObject. If the ActiveXObject "MSXML2.DomDocument.X.X" cannot be found try to find ' another version on MSDN. Set objXML = Server.CreateObject("MSXML2.DomDocument.3.0") objXML.loadXML(objXmlHttp.responseText) strSessionId = objXML.selectNodes("/").item(0).text Set objXML = Nothing Set objXmlHttp = Nothing strJournalXml = "<Journal xmlns=""urn:xmlns:http://www.theyukicompany.com:journal""" & _ " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">" & _ " <AdministrationID>" & strAdministrationId & "</AdministrationID>" & _ " <AdministrationCoCNumber>12345672</AdministrationCoCNumber>" & _ " <DocumentSubject>Trx import april</DocumentSubject>" & _ " <JournalType>EndOfYearCorrection</EndOfYearCorrection>" & _ " <JournalEntry>" & _ " <ContactName>Apple Sales International</ContactName>" & _ " <ContactCode>9921</ContactCode>" & _ " <EntryDate>2012-12-31</EntryDate>" & _ " <GLAccount>20000</GLAccount>" & _ " <Amount>22.22</Amount>" & _ " <Description>Inkopen hardware</Description> " & _ " </JournalEntry>" & _ " <JournalEntry>" & _ " <ContactName>Apple Sales International</ContactName>" & _ " <ContactCode>9921</ContactCode>" & _ " <EntryDate>2012-12-31</EntryDate>" & _ " <GLAccount>20000</GLAccount>" & _ " <Amount>-22.22</Amount>" & _ " <Description>Retour hardware</Description>" & _ " </JournalEntry>" & _ "</Journal>" ' Build SOAP XML message for WebServiceMethod "http://www.theyukicompany.com/ProcessJournal". strXml = "<?xml version=""1.0"" encoding=""utf-8""?>" & _ "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" & _ "<soap12:Body>" & _ "<ProcessJournal xmlns=""http://www.theyukicompany.com/"">" & _ "<sessionID>" & strSessionId & "</sessionID>" & _ "<administrationID>" & strAdministrationId & "</administrationID>" & _ "<xmlDoc>" & strJournalXml & "</xmlDoc>" & _ "</ProcessJournal>" & _ "</soap12:Body>" & _ "</soap12:Envelope>" ' Create ServerXMLHTTP object. Set objXmlHttp2 = Server.CreateObject("Msxml2.ServerXMLHTTP") objXmlHttp2.open "POST", strWebserviceUrl, False objXmlHttp2.setRequestHeader "SOAPAction", "http://www.theyukicompany.com/ProcessJournal" objXmlHttp2.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8" objXmlHttp2.setRequestHeader "Content-Length", Len(strXml) ' Send SOAP message. objXmlHttp2.send strXml ' Print out the request status. Response.Write "WebServiceMethod ""ProcessJournal"" request status: <b>" & objXmlHttp2.status & " " & objXmlHttp2.statusText & "</b><br /><br />" ' Print out the SOAP XML response. Response.Write "<div style=""border: solid 1px black;"">" & Server.HTMLEncode(objXmlHttp2.responseText) & "</div>" Set objXmlHttp2 = Nothing %> |
Documentatie >