Utilizacion de WebService
Publicado por Oscar Rios (5 intervenciones) el 07/11/2017 20:41:05
Saludos
Estoy tratando de llamar a un webservice utilizando OLEObject me pasaron un código pero no consigo que opere:
Este código se car al hacer el lobj_dom.async = false, alguien que haya echo llamado a webservice con este método que me puada pasar algún ejemplo.
Estoy tratando de llamar a un webservice utilizando OLEObject me pasaron un código pero no consigo que opere:
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
43
44
45
46
47
48
int li_result,li_return
boolean lb_ret
int ll_xml_error_code,ll_xml_error_file_pos,ll_xml_error_line,ll_xml_error_line_pos
string ls_xml_error_message,ls_xml_error_source_text,ls_xml_error_reason,ls_node_value,ls_xml
///////////////////////////////////////////////////
string ls_name
OLEObject lobj_dom,lobj_http,lobj_node
ls_xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.consultaruc.registro.servicio2.sunat.gob.pe">'
ls_xml += ' <soapenv:Body>'
ls_xml += ' <ser:getDatosPrincipales>'
ls_xml += ' <numruc>20541328671</numruc>'
ls_xml += ' </ser:getDatosPrincipales>'
ls_xml += ' </soapenv:Body>'
ls_xml += '</soapenv:Envelope>'
lobj_http = create OLEObject
li_result = lobj_dom.ConnectToNewObject ("Msxml2.XMLHTTP.3.0")
if li_return <> 0 then
MessageBox ("Connection Error", "Unable to connect to the OLE object.~r~n~r~nError code = '" + String(li_return) + "'", Exclamation!, OK!)
return
end if
lobj_dom = create OLEObject
li_result = lobj_dom.ConnectToNewObject ("Msxml2.DOMDocument.3.0")
if li_return <> 0 then
MessageBox ("Connection Error", "Unable to connect to the OLE object.~r~n~r~nError code = '" + String(li_return) + "'", Exclamation!, OK!)
return
end if
// Set the parser attributes
lobj_dom.async = false
// Load the XML Document
lb_ret = lobj_dom.loadxml(ls_xml)
if lb_ret then
lobj_http.open('POST', is_url, False)
lobj_http.setRequestHeader('SOAPAction', is_url)
lobj_http.setRequestHeader('Content-Type', 'text/xml')
lobj_http.send(lobj_dom.xml)
end if
// LOOP through all the Book Nodes and get the values
lobj_node = lobj_dom.SelectSingleNode('//multiRef/cod_dep')
IF IsValid (lobj_node) THEN ls_name = String (lobj_node.Text)
IF IsValid (lobj_dom) THEN DESTROY lobj_dom
Este código se car al hacer el lobj_dom.async = false, alguien que haya echo llamado a webservice con este método que me puada pasar algún ejemplo.
Valora esta pregunta


0