Hi, regarding to #498 I experience the same problem on my local machine.
New-NavContainer -accept_eula -accept_outdated -containerName test14bc -imageName mcr.microsoft.com/businesscentral/onprem:14.0.29537.31761-at-ltsc2019 -includeCSide -licenseFile E:\lizenz\lizbc.flf -enableSymbolLoading -auth NavUserPassword -clickonce -shortcuts Desktop -updateHosts
(here the -auth makes no difference even when I use Windows)
My web service code in AL (also tried with C/AL but same result)
codeunit 70005 TestWS
{
[ServiceEnabled]
procedure add(a: Integer; var b: Integer);
begin
b := a + b;
end;
}
When I publish the web service on the container I can access it as excpected. Also all Odata web services are working.
But when I now try to use this function with WebServiceStudio or with Wizdler (Chrome) I get the following erros.
Error in Wizdler:
Failed to get response (Not Found).
Error in WebServiceStudio
System.Reflection.TargetInvocationException: A call target caused an exception. ---> System.InvalidOperationException: The request content type found by the client is '', expected was 'text / xml'.
Error: Empty response on request.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse (SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (String methodName, Object [] parameters)
at WSInterfac.Add (Int32 a, Int32 & b)
My colleague also tried this with a container but with a different image. (some bc15 image) and had the same errors.
On an installed OnPrem Version it's working.
I also tried to use another soap port and ServicesUseNTLMAuthentication=true but no success.
Firewall is off
Any ideas?
When you start a container without any of your own extensions - can you then access the customer card page web service?
I can access all wsdl definitions. But I can't use any function. (SalesOrder - ReadMultiple)
By default, I can't find any customer card so I tried with the default web services which are accessible via soap. (Job, SalesOrder, ..) wsdl is there but no function is working.
OData brings all Data as expected.
Please provide a PowerShell script, which creates the container and tries to read customers through ReadMultiple, then I can repro and fix whatever mistake you have in the script (assuming that this is a script mistake).
I can give it a try. But I'm reading customers with Wizdler (Google Chrome) or WebServiceStudio.
WebServiceStudio
But what I try now is setting up a Windows Server 2019 with Docker and try it there too.
Yeah, sorry don't know these tools.
Had a quick look - and I think there is a bug somewhere.
The PublicSoapBaseUrl should be ending in a / - it doesn't.
Modify customsettings.config (you can use enter-navcontainer in PowerShell ISE and PSEdit to do remote editing), append the / and restart the service tier (set-navserverinstance bc -restart)
After that change, this works:
$service = New-WebServiceProxy -Uri "http://bc:7047/BC/WS/CRONUS%20International%20Ltd./Page/SalesOrder" -Credential $credential
$service.ReadMultiple($null,'',0)
Will try to figure out where the bug is.
The bug is in the generic image:-(
Meaning that all tools, which uses the URL in the WSDL over the URL given will get this wrong.
You can fix it when creating the container by specifying the PublicSOAPBaseUrl:
-additionalParameters @( "--env customnavsettings=PublicSOAPBaseurl=http://$containername:7047/BC/WS/" )
That should do the trick.
Thank you @freddydk that did the trick.
But how could you figure this out that fast?
As soon as I had a scriptable repro, I look at the WSDL and saw that the /WS/ part was missing. Looked in customsettings.config - saw the comments included an ending / - added one.
Next generic image will fix this. I won't re-build all images, if you need this in an image, which doesn't have it, easiest method is to append
-myscripts @( "https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/SetupConfiguration.ps1" )
Basically, this script should work:
$imageName = "mcr.microsoft.com/businesscentral/onprem"
$auth = "UserPassword"
$credential = New-Object pscredential 'admin', (ConvertTo-SecureString -String 'P@ssword1' -AsPlainText -Force)
$containerName = "test"
$companyName = "CRONUS International Ltd."
New-BCContainer -accept_eula `
-imageName $imageName `
-containerName $containerName `
-auth $auth `
-Credential $credential `
-updateHosts `
-myScripts @("https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/SetupConfiguration.ps1")
$service = New-WebServiceProxy -Uri "http://$($containerName):7047/BC/WS/$([Uri]::EscapeDataString($CompanyName))/Page/SalesOrder" -Credential $credential
$service.ReadMultiple($null,'',0) | % { Write-Host "Order #$($_.No) to customer: $($_.Sell_To_Customer_Name)" }
Most helpful comment
Next generic image will fix this. I won't re-build all images, if you need this in an image, which doesn't have it, easiest method is to append
-myscripts @( "https://raw.githubusercontent.com/microsoft/nav-docker/master/generic/Run/SetupConfiguration.ps1" )Basically, this script should work: