xml - How to send SOAP via HttpRequest in VB6 -


now i'm working soap in vb6 , have trouble. need send soap web server , save result xml file.

here httprequest sample scraped site.

for more detailed information, please see url. https://www.ftq360.net/collect/exportsvc_jrjc.asmx?op=exportjrjc

i installed soap toolkit3.0 , added microsoft soap3.0 library in vb reference dialog. after googling, wrote code below , there no error.

my trouble have after that! i'm @ vb don't know web service. hope quick help. everybody.

as long client can use msxml-api handling http communication soap-server.

here example class http-handling:

option explicit private httphandler msxml2.serverxmlhttp  public event onreadystatechange()  public sub sendsoaprequest() dim soapdocument msxml2.domdocument      'set document     'eigther string     soapdocument.loadxml "<xml......"     'or file     soapdocument.load "c:\foo\soapdoc.xml"     'or assembling in code (see msxml-documentation)     soapdocument.appendchild soapdocument.createnode(node_element, "soapdocrootnode", "namespaceuri")     soapdocument.documentelement soapdocument.createnode(node_element, "soapdoc1stchild", "")     '...      sendrequest soapdocument, "http://soapserver:8080/someresurce/" end sub  private sub sendrequest(xmldoc msxml2.domdocument, url)  on error goto errreq     'setting url , request type (in case post transmit xml-document)     httphandler.open "post", url, true     'setting request-header     'optional servers require     httphandler.setrequestheader "content-type", "text/xml"     httphandler.setrequestheader "accept", "text/xml"     httphandler.setrequestheader "accept-charset", "iso-8859-1" 'adapt server-settings       httphandler.send xmldoc      doevents      exit sub errreq:     msgbox "sendrequest: error while sending request" + vbcrlf + err.description end sub  private sub onreadystatechange() 'important: procedure has set default in procedure attribites dialog 'otherwise can poll readystate become value of 4 dim receiveddoc msxml2.domdocument dim start single  on error goto errnewdata      'while readystate below 4 there no result available yet     if httphandler.readystate <> 4 exit sub      'check server-result 200 (ok)     if httphandler.status <> 200 'ok         'something went wrong @ server site         msgbox "onreadystatechange: server responded error message" + vbcrlf + _                 httphandler.status + vbcrlf + _                 httphandler.statustext         exit sub     end if      'wait returned document parsed     start = timer     until receiveddoc.parsed         doevents         'if running on midnight         if start > timer start = start - 86400          'timeout of 5 seconds         if timer - start > 5             msgbox "onreadystatechange: timeout while paring returned document"             exit sub         end if     loop      if receiveddoc.parseerror <> 0         msgbox "onreadystatechange error while parsing returned document" + vbcrlf + _                 receiveddoc.parseerror.reason + vbcrlf + _                 "position: line" + cstr(receiveddoc.parseerror.line) + " row" + cstr(receiveddoc.parseerror.linepos)         exit sub     end if      responsehandler      exit sub errnewdata:      msgbox "onreadystatechange: error while processing server response" + vbcrlf + err.description  end sub  private sub responsehandler(xmldoc msxml2.domdocument)     'handle response end sub 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -