You need to sign in to do that
Don't have an account?

How to Return a Constructed SOAP Body instead of Salesforce generated SOAP Body from a Webservice
Hi,
I wish to have webservice functions which when called I will create a SOAP body which I then return in my response. If I set the return type to String for my webservice function the stting gets included as CData in a <result> element.
E.G.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/TestSOAPWebserviceFromSites">
<soapenv:Body>
<GetMsgRQResponse>
<result><![CDATA[<soapenv:Body><GetMsgRS><result>Success: Name=My Test</result></GetMsgRS></soapenv:Body>]]></result>
</GetMsgRQResponse>
</soapenv:Body>
</soapenv:Envelope>
If I wish to override the SOAP Body generated by Salesforce and instead make it my own generated SOAP body what is the return type I need to use for my function?
Thanks in advance for any help.
Hi @SalesRed,
I also have to return an XML in the response.
According to the Apex Web Services and Callouts documentation, salesforce supports the token datatype of WSDL, which seems to be the most compatible datatype for CDATA.
Unfortunately, I didn't find find any apex datatype to be returned as token.
The most compatible datatype I found was Blob, it results as xsd:base64Binary, which can be decoded by the consumer.
Hi rforce2, What I need to do is make sure my response meets an industry defined SOAP response specification. I therefore need to be able to write/create the full SOAP response that is returned as opposed to it being part of a Salesforce generated Response.
I know I can do this via a HTTP Request but for my required scenario I cannot callout to a specific endpoint. I need to provide my SOAP response to the SOAP request the external party has made to Salesforce.
If this cannot be done then I may not be able to develop to meet my required specifications.
Thanks (& to any others) for any help on this.