Hello ppl. Im try working with connecting a webservice through a codeunit but i got this popup error while running the codeunit:
This message is for C/AL programmers: The call to member save failed. msxml3.dll returned the following message: Adgang nægtet
“Adgang nægtet” is mean ‘access denied’ in danish.
Im using NAV 5.0 and has downloaded and installed a Soap Toolkit 3.0 (‘Microsoft Soap Type Library v3.0’).
I seem like the codeunit find the webservice but it got problem while try saving the xml response - what has I do wrong?
The webservice:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace WebService1
{
///
/// Summary description for Service1
///
[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return “Hello World”;
}
}
}
Codeunit:
IF ISCLEAR(SoapHttpConn) THEN
CREATE(SoapHttpConn);
SoapHttpConn.Property(‘EndPointURL’,‘http://localhost/Service1.asmx’);
SoapHttpConn.Connect;
SoapHttpConn.Property(‘SoapAction’,‘http://tempuri.org/HelloWorld’);
SoapHttpConn.BeginMessage;
IF ISCLEAR(SoapSerialize) THEN
CREATE(SoapSerialize);
SoapSerialize.Init(SoapHttpConn.InputStream);
SoapSerialize.StartEnvelope(’’,‘STANDARD’);
SoapSerialize.StartBody;
SoapSerialize.WriteXml(’’);
SoapSerialize.EndBody;
SoapSerialize.EndEnvelope;
SoapHttpConn.EndMessage;
IF ISCLEAR(XmlDom) THEN
CREATE(XmlDom);
XmlDom.load(SoapHttpConn.OutputStream);
XmlDom.save(‘c:\temp.xml’);