// Using the Base 64 encode with streams // to generate the password int:= PassOutStr.WRITETEXT('xxxxxx:xxxxxxx'); Base64Encode(PassInStr, PassOutStr1); int:= PassInStr1.READTEXT(Passtxt); Passtxt := 'Authorization: Basic '+Passtxt; //the request XMLport fills the BLOB with the XML message CLEAR(XP1); XP1.SETDESTINATION(OutStr1); XP1.EXPORT; //load the message into the XML automation variable IF ISCLEAR(XMLDoc) THEN CREATE(XMLDoc); XMLDoc.load(InStr1); //this is for diagnostics only, so you can see what the XMLport actually produced XMLDoc.save('C:\XMLRequest.xml'); //create the HTTP connector IF ISCLEAR(XMLHttpConn) THEN CREATE(XMLHttpConn); //tell it where the web service is located XMLHttpConn.open('POST', 'https://www.xxx.xx', FALSE); //set some values in the request header depending on what the service requires XMLHttpConn.setRequestHeader('Content-Type','text/xml'); XMLHttpConn.setRequestHeader('Authorization', Passtxt); //actually send the message XMLHttpConn.send(XMLDoc); //tell us if we got an error (it is 200 because the response definition said "200 OK") IF XMLHttpConn.status <> 200 THEN BEGIN MESSAGE('Status %1 2%',XMLHttpConn.status,XMLHttpConn.statusText); EXIT; END; IF ISCLEAR(XMLDoc) THEN CREATE(XMLDoc); XMLDoc.load(XMLHttpConn.responseXML); //this is for diagnostics only, so you can see what you got back XMLDoc.save('C:\XMLResponse1.xml');
Answers
try to compare passtxt in the following website.
http://www.motobit.com/util/base64-decoder-encoder.asp
or here
http://makcoder.sourceforge.net/demo/base64.php
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
XMLHttpConn.open('POST', 'https://www.xxx.xx', FALSE,login,password);
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thanks for your fast reply.
I knew the passtxt was alright, so i tried the second solution. Now i don't get an authorization error, now i just didn't get anything in the file i save. So i guess i found another problem and put in a parseerror function.
It returns :
The system cannot locate the object specified. Error processing resource 'xxxxx.dtd'.
Errorcode : -2146697210
Now i just need a dtd document in my system, but where do i put this?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thanks again for your answers.
It is the response i get back and the XMLDom can not parse this response, because it needs the dtd document in the system, but i don't know where to put this document?
In the response i get :
So i hoped that someone knew where to put it or what to do with dtd files to make the system know where it is.
Here is a person having the same proble but with excel
http://forums.techguy.org/business-appl ... ource.html
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
That's where i got my error.
To bad i can't solve the problem the same way as the excel guy
xmlDoc.validateOnParse := false;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I did try that and that didn't help, but i found another solution.
First i used this automation :
'Microsoft XML, v6.0'.DOMDocument
And by a mistake i picked another :
'Microsoft XML, v6.0'.DOMDocument60
Then the following code worked
Thanks for you help all the way \:D/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Can you help with Base64Encode - as I'm going to communicate via POST-https - and as I see it - we have a problem with sending password...As you had...
Can you guide me a little?
Henrik Frederiksen, Denmark