I made a dll (C#) to call a webservice. Also a test client (console app) in C#. Works perfectly. Next I set up a new form to test the dll from Navision 4.00SP2. Automation variable referring to the typelib. So far so good. Running the form I get the message :
"De aanroep van functie AddArticle is mislukt. System.Web.Services gaf de volgende melding:
De server heeft een fout in het protocol veroorzaakt. Section=ResponseStatusLine"
Translated: The call to the function AddArticle failed. Web.Services returned the following description:
The server caused an error in the protocol. Section=ResponseStatusLine"
You guess my question: HEEELP! ;-)
0
Answers
System.Net.WebException: De server heeft een fout in het protocol veroorzaakt. Section=ResponseStatusLine
bij System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
bij System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
bij System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
bij LogicsWebService.zdlLogicsWebService.Service.AddArticle(String articleCode, String articleName)
bij LogicsWebService.LogicsWebService.AddArticle(String artCode, String artName)
I use authentication: clsService.Credentials = new System.Net.NetworkCredential(m_userID,m_password);
The authentication works well, cause the first calls from Navision were with a invalid user/pwd and that results in the error "401 - unauthenticated" or something like that.
[edit] Correction on the authentication. If I mess up the login/pwd, I still get the ResponseStatusLine error. But my C# testapp does work fine with the latest webservice dll.[/edit]
IF ISCLEAR(clsWS) THEN
CREATE(clsWS);
clsWS.UserID := uID;//=Text: qqq
clsWS.Password := pwd;//=Text: yyy
iResult := clsWS.AddArticle(artCode,artName); // 2x Text: X and Y, result = Integer
CLEAR(clsWS);
C# code:
public int AddArticle(string artCode,string artName)
{
this.SetCredentials();
try
{
return clsService.AddArticle(artCode,artName);
}
catch(Exception e)
{
System.Windows.Forms.MessageBox.Show(e.ToString());
return -1000;
}
}
C# code part from the Webreference/wsdl.exe:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://LogiqsAgro.com/AddArticle", RequestNamespace="http://LogiqsAgro.com/", ResponseNamespace="http://LogiqsAgro.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int AddArticle(string articleCode, string articleName) {
object[] results = this.Invoke("AddArticle", new object[] {
articleCode,
articleName});
return ((int)(results[0]));
}
Beats me! Thanks 100x anyway!
One little thing that you might also know: Every time I registered the modified dll I get a new entry in the automation server list in Navision. If I unregister the dll with regasm xxxx.dll /u, the entry is not selectable in Navision, but is still there. I register with regasm xxxx.dll /t. Is it possible to use the same entry over and over?