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
hirb24hirb24 

SOAP faultcode response

Hi,

 

I am programming a webservice in Salesforce and I would like to set my own faultcodes and faultstrings. 

I would like to send this kind of response if an error occurs: 

 

<soapenv:Fault>

         <faultcode>100</faultcode>

         <faultstring> MyMessage</faultstring>

</soapenv:Fault>

 

Is it possible in Salesforce?

 

Thanks

UVUV

Yes I believe this can be done.

Bidun TummalaBidun Tummala

Can you please help me i understand how thi can be done?

 

i was able to generate the Fault string but not the Fault Code..

 

Any help is appriciated...

 

 

public class SoapmsgException extends Exception {}

Webservice static string ContactMethod(String lpid,String Req)
{

 

...

..

if(lpid.length() == 0)

throw new SoapmsgException ('Invalid LPID or Customer belongs to outfoot Print State');

 

}

 

This is how i was able to generate the Fault string... But was not able generate the fault code.

 

 

Thanks.