WHo knows the problem and how to solve this.
If I send an XML File with :
CREATE(XMLHTTP);
CREATE(locautXmlDoc);
FileSize.OPEN('v:\File.xml');
FSize:=FileSize.LEN;
FileSize.CLOSE;
locautXmlDoc.async:=FALSE;
locautXmlDoc.load('v:\File.xml');
XMLHTTP.open('POST','
http://b2b-test.actebis.com/invoke/ActDelivery_HTTP.Inbound/receiveXMLsynchronous',0);
XMLHTTP.setRequestHeader('Content-Type: ', 'text/xml; charset="UTF-8"');
XMLHTTP.setRequestHeader('Authorization: ', 'Basic XXXXXXXXXXXXXXXXXX');
XMLHTTP.setRequestHeader('User-Agent: ', 'SCHttpPostData/1.1');
XMLHTTP.setRequestHeader('Host: ', 'b2b-test.actebis.com');
XMLHTTP.setRequestHeader('Content-Length: ', FORMAT(FSize));
XMLHTTP.setRequestHeader('Connection: ', 'Keep-Alive');
XMLHTTP.setRequestHeader('Cache-Control: ', 'no-cache');
XMLHTTP.send(locautXmlDoc);
locautXmlDoc.load(XMLHTTP.responseXML);
locautXmlDoc.save('v:\FileRSP.xml');
IF XMLHTTP.status = 200 THEN
MESSAGE('%1',Text0001)
ELSE
MESSAGE('%1', XMLHTTP.status);
It wil work Fine.
If I Replace some with fields from the customer table like
Vendor.GET(PurchaseHeader."Buy-from Vendor No.");
CLEAR(XMLHTTP);
CLEAR(locautXmlDoc);
CREATE(XMLHTTP);
CREATE(locautXmlDoc);
FileSize.OPEN('c:\File.xml');
FSize:=FileSize.LEN;
FileSize.CLOSE;
locautXmlDoc.async:=FALSE;
locautXmlDoc.load('c:\File.xml');
XMLHTTP.open('POST',Vendor."XML POST Commando",0);
XMLHTTP.setRequestHeader('Content-Type: ', Vendor."XML Content Type");
XMLHTTP.setRequestHeader('Authorization: ', Vendor."XML Auhorization");
XMLHTTP.setRequestHeader('User-Agent: ',Vendor."XML User Agent");
XMLHTTP.setRequestHeader('Host: ', Vendor."XML HOST");
XMLHTTP.setRequestHeader('Content-Length: ', FORMAT(FSize));
XMLHTTP.setRequestHeader('Connection: ', 'Keep-Alive');
XMLHTTP.setRequestHeader('Cache-Control: ', 'no-cache');
XMLHTTP.send(locautXmlDoc);
locautXmlDoc.load(XMLHTTP.responseXML);
It won't send anything!
I checked via ´message' the fields contain the exact info as in the first code.
What to do ? ](*,)
Comments
Did you find a solution in the meantime?
Today I found a similar problem in a code section.
Regards
Kappe
Kappe
idea 1.)
Vendor."XML Auhorization" is a password-type field and can not be decoded as clear text
idea 2.)
It's related to spaces because normally it's easy to overlook those in a message box. Maybe the space after "Basic"
To avaoid any network problems, I would try to start it against a local webserver, e.g. IIS or a simple debug webserver
MCP+I, MCSE NT, Navision MCT (2004,2005)
Thanks for your fast reply!
I was looking more at these lines:
XMLHTTP.open('POST','http://b2b-test...',0); (Working)
XMLHTTP.open('POST',Vendor."XML POST Commando",0); (Fails)
I use a Text variable instead of the Vendor data in my code:
XMLHTTP.open('POST',HTTPADDRESS,0);
But it only works if I hardcode an address. ](*,)
The only difference is that my address also contains the port.
XMLHTTP.open('POST','http://...:4711',0); (Also Working)
Regards
Christian
Kappe
although this should be not the problem:
replace the ASYNC param 0 by false as it is a BOOLEAN.
I know, it sounds stupid, but did you really verify the content of the variable directly before the open ? I mean, compare the length of the string, maybe there is an additional space. No clue, why it should not work. XMLHTTP.OPEN is generally working when the URL is provided as a variable. So, somehow it seems to be related to Navision.
Did you try to use a variable as a constant or by assignment instead of a field ?
e.g.
But an other topic: you will not be able to catch any occuring error, like connection timeout, connection refused etc. They will lead to a "This is a message for C/AL developers..." message. Without a wrapper which traps all errors and returns them in a safely manner (e.g. because of 1024 bytes text limitation even with implicit type conversion during usage of automation variables), you will not be able to use this component for non-interactive communication.
MCP+I, MCSE NT, Navision MCT (2004,2005)
Thanks for your hints!
The O and the False had the same result...no message.
But with your other hints I could get it working! \:D/
We added in our code a '/' to each address - this caused the problem.
And regarding your other question - we only need to "fire&forget" the XML.
Regards
Christian
Kappe
nice to see this issue being solved So I guess, this might also be the problem of wwestendorp
MCP+I, MCSE NT, Navision MCT (2004,2005)