function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Return exception in web service to external app

I have a web service in SFDC. it is being called by external java app. inputs are sent into web service and output is returned as sobject.
global class Pipeline {

  WebService static opportunity[] Apptaker(string adid, string Ftype, date Frmdt, date todt, string stype, string sorder) {

opportunity[] opp;
return opp;
Now I have not handled exceptions. In case there is any exception from web service, how do I return error to the UI java app
exceptions in apex will be returned as soap faults to the client.
Soap fault is not present in the WSDl that is created for the web service.
If it is standard then probably, we dont have to incorporate it in the code?
SOAP faults are defined in the SOAP protocol, and generally don't appear in the WSDL (unless the server is returning an extension to the soap fault structure).

Most soap stacks will automatically turn a soap fault into a thrown exception (for languages that use exceptions)
So exactly what do I do to avail this facility.
which part, the apex stuff is all automatic, for how soap faults are handled in your client code, you'll have to read the docs for whatever soap client you're using.

That will be java application. That application will consume our Enterprise WSDl to login in SFDC. Then the WSDL for the web service to call it.

How will SOAP section be implemented. Any recommendations or pointers.

There's about 20 soap stacks for java, so you'll need to consult the docs for the one you're using. If you're using Axis 1.x, then it will automatically throw an AxisFault exception if the server returns a soap fault.

Thanks Simon, As ever you have resolution for anything nd everything.

If you kindly look into my other issue as well.

In my other thread

Thanks and Best Regards