Error while calling a codeunit from action pane in RTC
prabhupdesh
Member Posts: 49
Hi all,
I have created a codeunit which is called from action pane in customer card. But while calling from action pane i am getting following error as mentioned below:
"The server "net.[url=tcp://localhost:7046/DynamicsNAV/Service]tcp://localhost:7046/DynamicsNAV/Service[/url]" is either unavailable or your connection has been lost. Do you want to attempt to reconnect".
On clicking YES on the error dialog box the RTC simply closes and gives a second eror message as below:
"The connection to the server is lost.The application will close."
This functionality is working fine in classic client.
Please help!!!
I have created a codeunit which is called from action pane in customer card. But while calling from action pane i am getting following error as mentioned below:
"The server "net.[url=tcp://localhost:7046/DynamicsNAV/Service]tcp://localhost:7046/DynamicsNAV/Service[/url]" is either unavailable or your connection has been lost. Do you want to attempt to reconnect".
On clicking YES on the error dialog box the RTC simply closes and gives a second eror message as below:
"The connection to the server is lost.The application will close."
This functionality is working fine in classic client.
Please help!!!
0
Answers
-
what is this codeunit doing?0
-
Hi,
Thanks for the response.
This codeunit is performing the following tasks:
1.First, it exports some data(in customer table) using xmlport.
2.Then it send the xml using http post method to a webservice
3.Then it receives the response from the webservice and imports the data in a table using xml port
This whole functionality is working well in classic client, only when I try doing it in RTC, that i receive the said message.
Please find a code part:
CLEAR(TempBlob);
TempBlob.Blob.CREATEOUTSTREAM(Ostream);
XmlPort.SetCurrencyCodes(Para A,Para B,Para C);
XmlPort.SETDESTINATION(Ostream);
XmlPort.EXPORT;// if i comment & rest of the code after message('hi') ,then i dont get the error message and i receive 'hi' message.
Message('hi');
.......rest of the code to call 'send soap message'..
Please help.0 -
does you xmlport have namespaces in it?
It looks like the service tier is crashing. Check the eventlog on service tier.0 -
Yes , i am using name space.
Following is the message found in the log:
Service: MicrosoftDynamicsNavServer
User: adder\Admin
Type: System.ArgumentException
Message: Invalid name character in 'soap:Envelope'. The ':' character, hexadecimal value 0x3A, cannot be included in a name.0 -
I suggest to remove the namespaces from the xmlport.
After you run Xmlport.export
Load the stream into MSXMLDocument.
create a function that will add namespaces and return a new DOM Object.
Then send that to web services.0 -
thanks.let me try this, will revert back soon0
-
Thanks.SOLVED0
-
edit the first post and change the option below the tile to solved.0
-
Hi prabhupdesh,
Would it be possible for you to post a sample of the code you are using to do this?
I run into the same problem but I am not being able to getting it to work, so I would appreciate any help with a code sample.
thanks in advanceJoao Jesus
jpjesus@netcabo.pt0 -
XML is a blob field. You can use Tempblob table.
XML.CREATEOUTSTREAM(outstr); POXMLPort.SetHeader(PurchHeader); POXMLPort.SETDESTINATION(outstr); POXMLPort.EXPORT; CALCFIELDS(XML); IF NOT XML.HASVALUE THEN EXIT; XML.CREATEINSTREAM(instr); //XML.EXPORT('c:\nav\xmlblob.xml'); //if you want to see the xml file. MSDOM.async := FALSE; MSDOM.load(instr); AddNamespace(MSDOM); //now msdom has the namespaces and you can send it or save it //MSDOM.save('c:\test.xml'); //XMLHTTP.send(MSDOM);
AddNamespace looks like this, but in your case it will be different depending on how your xml file looks like.AddNamespace(VAR MSDOM2 : Automation "'Microsoft XML, v6.0'.DOMDocument") IF ISCLEAR(MSDOM) THEN BEGIN CREATE(MSDOM); MSDOM.async := FALSE; END; XMLNode2 := MSDOM2.documentElement.selectSingleNode('/NAV/Header/MessageType'); MsgType := XMLNode2.text; Ch10 := 10; CH13 := 13; CH9 := 9; Separator := FORMAT(CH13) + FORMAT(Ch10) + FORMAT(CH9); MSDOM.loadXML('<?xml version="1.0" encoding="utf-8"?>' + Separator + '<ns1:NAV xmlns:ns0="http://NAV.NAV.SharedSchemas.Schemas/Header" ' + 'xmlns:ns1="http://NAV.NAV.SharedSchemas.Schemas/'+MsgType+'">' + Separator + '<ns0:Header>' + Separator + '</ns0:Header>' + Separator + '</ns1:LSR>'); XMLNode := MSDOM.documentElement.firstChild; XMLNode2 := MSDOM2.documentElement.selectSingleNode('/NAV/Header/MessageId'); XMLNode.appendChild(XMLNode2); XMLNode2 := MSDOM2.documentElement.selectSingleNode('/NAV/Header/DateCreated'); XMLNode.appendChild(XMLNode2); XMLNode := MSDOM.documentElement; XMLNode2 := MSDOM2.documentElement.selectSingleNode('/NAV/Message'); XMLNode.appendChild(XMLNode2); MSDOM2 := MSDOM;0 -
Hi,
The solution worked initially but started giving the same problem when we did some more modification. Finally i found that the error arised when xml port(meant for exporting the data & create a xml file) was called, so instead of calling the xml port to export the data & create an xml file, I exported the data and created the xml in the way as shown below:
CREATE(XmlEnv);
XmlEnv.preserveWhiteSpace := FALSE;
XmlEnv.loadXML(
'<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
' <soap:Body>' +
' <getNameRequest xmlns="http://Abcd.com" xmlns:doc="http://abcd.com">' +
' <add>'+
' <city>'+PC+'</city>'+
' <postCd>'+Pd+'</postCd>'+
' </add>'+
' </getNameRequest>'+
' </soap:Body>'+
' </soap:Envelope>');
where pc,pd are the variables containing data.,
Thanks,
Prabh0 -
let me also try with the solution given by ar3n0
-
I think these can be done using UseDefaultNamespace and DefaultNamespace properties of XMLPort ?0
-
Hi
@navinb
I don't think that one can use those properties in this case. As far as I could read on several forums these properties can only be applied to a single namespace. If you have more than one, like I do, it won't work.
@All
Another thing I manage to find out is that this is not directly related to namespaces. I removed all references to namespaces that I was using on my XMLPort, as well to the SOAP.
If a single TAG as the character ":" in it, this error will pop up in the RTC. In my case, bcause the webservices I have to invoke use something like "cdp:ItemCode" in all tags, I need to use the ":" in all tags..... darn
Not sure that I can persuade the WebServices provider into changing the tags.....Joao Jesus
jpjesus@netcabo.pt0 -
Opened a new post for this issue:
http://www.mymibuso.org/forum/viewtopic.php?f=32&t=40874&sid=6db8bf86c0c1bc5bd4e828924dc9be16Joao Jesus
jpjesus@netcabo.pt0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
