[SalesForce] Web service callout failed: WebService returned a SOAP Fault: System.StringException: Invalid id

I'm implementing Salesforce Org to Org SOAP API. I'm using Partner WSDLs.
I have created the Web Service from Org1 but while consuming it from Org2, I'm getting the following error.

System.CalloutException: Web service callout failed: WebService
returned a SOAP Fault: System.StringException: Invalid id: red
newcolor Class.MySOAPWebService.makeContact: line 4, column 1
faultcode=soapenv:Client faultactor=

The ORG1 method which has been exposed in API is simply returning a string.

global class MySOAPWebService {
    webservice static Id makeContact(String color) {
        String newColor = color + ' newcolor';
        return newColor ;
    }
}

Please can anyone point me what is the cause of error.
Thanks in Advance.

Best Answer

Can you please try changing the return type from Id to string like below:

webservice static String makeContact(String color)

Related Topic