To debug a Web Service Codeunit and have the debugger attach to the WebServiceClient session, follow these steps:
1. Ensure your Web Service is Published and Enabled:
The codeunit must be published as a SOAP web service in your BC environment.
2. Correct launch.json Configuration:
Your launch.json looks mostly correct, but make sure the "breakOnNext": "WebServiceClient" matches exactly and that you’re attaching before invoking the web service call from Postman.
3. Start Debugger Before Calling Web Service:
Launch the debugger with the “Attach” configuration first, so it waits for the next WebServiceClient session.
4. Invoke the Web Service Call Quickly:
After starting the debugger, immediately send the SOAP request from Postman. The debugger attaches only if the call happens after debugger is listening.
5. Check Environment and Permissions:
Make sure you are attached to the correct sandbox environment.
Your user must have debugging permissions.
6. If No Session Appears:
Try restarting the BC sandbox environment.
Clear your VS Code cache or restart VS Code.
Confirm the environment logs to check if the web service call is hitting the service tier.
7. Alternative:
Add a temporary ERROR('Debug point'); statement in the codeunit to force a break and check if that triggers the debugger.
Mark the checkbox below if this answers your question.