Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MsXML2.ServerXMLHTTP
Message
From
04/10/2022 12:56:32
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Web Services
Title:
MsXML2.ServerXMLHTTP
Miscellaneous
Thread ID:
01685028
Message ID:
01685028
Views:
65
I wrote function to retrieve company data from web service but it returns status 500. I use VFP6. I can't find error in code. Coul'd you help me?
lPIB = some tin
STORE "" TO lMatBr, lNaziv, lNazivKratki, lAdresa, lMesto, lRegion, lPtt, lDelatnost
STORE CTOD("..") TO lDatReg, lDatOsniv

m.UNBSUser = some username
m.UNBSLoz = some password
m.UNBSLic = some licence

dtwwwGetCompany(lPIB, .F., @lMatBr, @lNaziv, @lNazivKratki, @lAdresa, @lMesto, @lRegion, @lPtt, @lDelatnost, @lDatReg, @lDatOsniv)

****************************************
FUNCTION dtwwwGetCompany( lPIB, lDeoNaziva, lMatBr, lNaziv, lNazivKratki, lAdresa, lMesto, lRegion, lPtt, lDelatnost, lDatReg, lDatOsniv )
****************************************

LOCAL loXMLHTTP
LOCAL soapEnvelope

SET SAFE OFF
SET TALK OFF

TEXT TO soapEnvelope TEXTMERGE  NOSHOW
TEXT

<?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:Header>
    	<AuthenticationHeader xmlns="http://communicationoffice.nbs.rs">
			<UserName><<m.UNBSUser>></UserName>
			<Password><<m.UNBSLoz>></Password>
			<LicenceID><<m.UNBSLic>></LicenceID>
		</AuthenticationHeader>
	</soap12:Header>
	<soap12:Body>
		<GetCompany xmlns="http://communicationoffice.nbs.rs">
			<companyID>00000000-0000-0000-0000-000000000000</companyID>
			<companyCode>0</companyCode>
			<name></name>
			<city></city>
			<nationalIdentificationNumber>0</nationalIdentificationNumber>
			<taxIdentificationNumber><<lPIB>></taxIdentificationNumber>
			<startItemNumber>0</startItemNumber>
			<endItemNumber>0</endItemNumber>
		</GetCompany>
	</soap12:Body>
</soap12:Envelope>

ENDTEXT

loXMLHTTP = CREATEOBJECT("MsXML2.ServerXMLHTTP")
cUrl  = "https://webservices.nbs.rs/CommunicationOfficeService1_0/CoreXmlService.asmx"

loXMLHTTP.open("POST", cUrl, .F.)
loXMLHTTP.setrequestheader('SOAPAction','http://communicationoffice.nbs.rs/GetCompany')
loXMLHTTP.setrequestheader('Content-Type','application/soap+xml;charset=UTF-8')
loXMLHTTP.send(soapenvelope)

WAIT WIND STR(loXMLHTTP.status)
Response (loXMLHTTP.ResponseTEXT) is
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---&gt; Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
Thanks in advance.
Next
Reply
Map
View

Click here to load this message in the networking platform