Hii all experts I am facing an issue and need your valuable suggestions,
Problem -->
1)NAV System XML File/data outstream
> 2)System 2(Reads the data processes it)
| |
4) <--NAV reads the data and stores it <
3)XML Stream data back to nav<
Most of the experts must have done this.. just seeking the idea... is it feasible if yes plz give an example of how to do it...? =P~
Thanks In Advance
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
The thing is that client doesnot wants to consume any web service.. what it needs is stream of data in XML kind of file.
I had given this Web service kind of solution but they are not ready to consume any kind of web service they simply want XML data stream into their system. :roll:
Any solution to create a stream of xml data that should go into there system?? or any other opinion please share...
Thanks in advance
Try this
CREATE XML in NAV:
Variables
Name DataType Subtype Length
InText InStream
OutText OutStream
LONGTEXT BigText
TempBLOB Record TempBlob
XMLHttp Automation 'Microsoft WinHTTP Services, version 5.1'.WinHttpRequest
Now, you can conver the LONGTEXT variable info into an INSTREAM.
Now you have your XML data in InText, so you can send it to a WS or save in a folder.
READ XML in NAV:
You need a function who receives a BIGTEXT parameter
Variables
Name DataType Subtype Length
XMLDocument Automation 'Microsoft XML, v6.0'.DOMDocument60
ReadStream InStream
WriteStream OutStream
TempBlob Record TempBlob
With this code, you can save the info you receive into a XML file. Now you can create some code or XMLPort to conver this XML and write this info in tables.
I hope this could be a start guide to do it.
Regards
I am seeking one more favor from you actually am working in 2031R2
system is generating following error while running the CU
Streams cannot be used with client-side invoked automation objects.
Any idea how can we deal with this???
Thanks in advance to Saalek and all other experts
I think this will be solved when you crear the automation instance.
CREATE(XMLDOCUMENT,false,TRUE);
Regards
I think this will be solved when you crear the automation instance.
CREATE(XMLDOCUMENT,false,TRUE);
Regards
Hii Saalek the code create(XMLDocument,FALSE,TRUE) i had already done that but system is giving error at
Xmlhttp.Send(Intext);
sorry but this could not be resolved by modifying create function as i have already done that...
Ny other suggestion.....
Thanks
Saalek
In my example. I sent you one Web Servce call example.
The URL isn't real. If you want to save the XML and not to send it, Use a XMLDOM.Document and save it in you local drive.
You can replace this text with
Regards
Whenever we are creating any automation variable for Example
CREATE(XMLDomDoc,FALSE,TRUE);
then we call the function
XMLDom.save(StreamOutObj); system generates the error..
Streams cannot be used with client-side invoked automation objects.
this happens with every automation which tries to save or load file.
Thanks for all ur help... =D>
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have the same problem, I need to connect at webservice of onther company, so I must use this sentence above!!?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I have to comunicate with another WS program, so I have used the example above, that for me is a good example but I can't to inizialize the Automation
object :
CREATE(XMLHttp,FALSE,TRUE);
every time it returned FALSE, darm it !!!
somebody may be help me!??
this is my code :
CLEAR(LONGTEXT);
LONGTEXT.ADDTEXT('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/wsdl/soap/"');
LONGTEXT.ADDTEXT('<soapenv:Header/><soapenv:Body>');
LONGTEXT.ADDTEXT('<?xml version="1.0" encoding="UTF-8/"?>');
LONGTEXT.ADDTEXT('<sgate:PresaInCaricoLotto xmlns:sgate="http://www.sgate.ancitel.it/xsd/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="xxxxxxxxxxxxxxxxxxxxxx/xsd/ 01_SGATEGAS_XSD_DISTRIBUTORI_v1.17.xsd">');
LONGTEXT.ADDTEXT(' <sgate:tipoRichiestaPresaInCaricoLotto>');
LONGTEXT.ADDTEXT(' <sgate:tipoMittente>');
LONGTEXT.ADDTEXT(' <sgate:Login></sgate:Login>');
LONGTEXT.ADDTEXT(' <sgate:Password></sgate:Password>');
LONGTEXT.ADDTEXT(' </sgate:tipoMittente>');
LONGTEXT.ADDTEXT(' <sgate:idUltimoLottoRicevutoCorretta></sgate:idUltimoLottoRicevutoCorretta>');
LONGTEXT.ADDTEXT(' <sgate:numeroMessaggi>2</sgate:numeroMessaggi>');
LONGTEXT.ADDTEXT('</sgate:PresaInCaricoLotto>');
TempBLOB.INIT;
TempBLOB.Blob.CREATEOUTSTREAM(OutText);
LONGTEXT.WRITE(OutText);
TempBLOB.CALCFIELDS(Blob);
TempBLOB.Blob.CREATEINSTREAM(InText);
ReturnValue := CREATE(XMLHttp,TRUE,TRUE);
IF ReturnValue = TRUE THEN BEGIN
XMLHttp.Open('POST','xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxo',FALSE);
XMLHttp.SetRequestHeader('Content-Type','text/xml; charset=utf-8');
XMLHttp.SetRequestHeader('SOAPAction', 'SendXMLFile');
XMLHttp.Send(InText);
END;
IF ISCLEAR(XMLDocument) THEN BEGIN
IF CREATE(XMLDocument,FALSE,TRUE) = TRUE THEN BEGIN
CLEAR(XMLDocument);
CREATE(XMLDocument,FALSE,TRUE);
TempBLOB.INIT;
TempBLOB.Blob.CREATEOUTSTREAM(WriteStream);
IncomeText.WRITE(WriteStream);
TempBLOB.CALCFIELDS(Blob);
TempBLOB.Blob.CREATEINSTREAM(ReadStream);
XMLDocument.load(ReadStream);
XMLDocument.save('C:\xml.xml');
END;
END;
thanks :?
Have you found a solution for the error?. Please guide me to solve the same error in my following code. I am getting the error while trying to Load the InStream.
//setup the temporary table so that we can handle the XML without saving it to disk first
//create a couple of streams to transfer the data in and out of the BLOB field
CLEAR(TempTable);
TempTable.Blob.CREATEINSTREAM(InStr);
TempTable.Blob.CREATEOUTSTREAM(OutStr);
//the request XMLport fills the BLOB with the XML message
CLEAR(XP1);
XP1.SETDESTINATION(OutStr);
XP1.EXPORT;
//load the message into the XML automation variable
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc,FALSE,TRUE);
XMLDoc.load(InStr);
//this is for diagnostics only, so you can see what the XMLport actually produced
XMLDoc.save('C:\Temp\XMLRequest.txt');
//create the HTTP connector
IF ISCLEAR(XMLHttpConn) THEN
CREATE(XMLHttpConn,FALSE,TRUE);
I have found this documentazion in internet :
Written by Vjekoslav Babic
http://NavigateIntoSuccess.com/
vjekoslav.babic@fortempo.net
This code is provided with no warranties of any kind, and you are using it entirely at your own responsibility.
You are free to use and modify this codeunit as you like and with no limitations, provided that:
1) You do not delete this Documentation trigger and do not put any other comments above this.
2) You visit my blog at http://NavigateIntoSuccess.com/ and leave a comment saying that this helped.
And of course - I leave the enforcement of these requirements entirely up to you :-)
It's very gret to read data from a page of a NAV2013 from other NAV2013 by a codeunit. Now I have neceserity to made a comunication from NAV2013 to NAV2013 trought the codeunits.
Somebody of you have just modify the code description before?
Hello,
When I try to use this code and send the http request, it gives me the following error: Unable to use streams with ActiveX objects called on the client side.
Can you help me? I did everything you listed to send the http request:
TempBlob.INIT;
TempBlob.Blob.CREATEOUTSTREAM(OutStream);
JsonBigText.WRITE(OutStream);
TempBlob.CALCFIELDS(Blob);
TempBlob.Blob.CREATEINSTREAM(InStream);
CREATE(Http, FALSE, TRUE);
Http.Open('POST', '[my endpoint]');
Http.SetRequestHeader('Content-Type', 'application/json');
Http.SetRequestHeader('Authorization', '[my auth]');
Http.SetRequestHeader('Accept', 'application/json');
Http.Send(InStream);
Thanks