hello community first of all good day I have a somewhat unusual situation
I am developing in business central a small project to consume a web service to which I have to connect to obtain some data for its manipulation
below I show my code of how I currently make the call of this web service from AL:
Variables uri: Text; RequestHeaders: HttpHeaders; RequestMessage: HttpRequestMessage; RequestContent: HttpContent; HttpClient: HttpClient; ResponseMessage: HttpResponseMessage; Content: HttpContent; text2Send: Text; PushHttpAddress: Text[80]; lSuccess: Boolean; ResponseInText: Text; ////////// Code/////////// content.Clear(); HttpClient.Clear(); RequestHeaders.Clear(); RequestMessage.Content().Clear(); ResponseMessage.Content().Clear(); ResponseMessage.Headers().Clear(); lSuccess := False; PushHttpAddress := 'https:/XXXXXXXXXXXXXXXXXXXXX'; uri := pushHttpAddress; RequestMessage.SetRequestUri(uri); RequestMessage.Method := 'POST'; text2Send := PBAXML; ------> Here i send the XML Soap buil before RequestContent.writefrom(Text2Send); RequestContent.GetHeaders(RequestHeaders); RequestHeaders.Remove('Content-Type'); RequestHeaders.Add('Content-Type', 'text/xml; charset=utf-8'); RequestHeaders.Add('SOAPAction', 'http://www.uniXXXXXXXXXXXXXXXXXXX'); RequestMessage.Content(RequestContent); if not HttpClient.Send(RequestMessage, ResponseMessage) then begin Message('Bad'); Error(''); end; Content := ResponseMessage.Content(); Content.ReadAs(ResponseInText); lSuccess := ResponseMessage.IsSuccessStatusCode(); Message(ResponseInText);
Well now the question here is that the aforementioned code works correctly in a local environment of central business but when I place the code in a Sanbox in the cloud it does not return a successful response
I don't understand why it doesn't work in the cloud
I hope you can guide me with your knowledge
and thanks for your time.
This project relates to a video where a US postal service web service is consumed. It works in the cloud as I have it deployed: https://github.com/hougaard/Youtube-Video-Sources/tree/master/USPS%20App
There are 3 videos that go with the project this is the first: https://youtu.be/kVvRnMNjeiM
this is a smaller video which is might be more applicable if your expected response is json: https://youtu.be/D5jzrgl1EP0
Sohail Ahmed
874
YUN ZHU
829
Super User 2025 Season 1
Mansi Soni
595