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
DemintDemint 

How to pass an external webservice child objects

Hi,

 

I am looking at design options to develop an integration to an external webservice.

 

The webservice will take a couple of fields off of a parent object (say account) and then a couple of fields from the set of child objects (say contact).

 

So for arguments sake lets say it takes the account name and site and then an array of contact name and postcodes.

 

It would be triggered by a button on the child object (so would send details about its parents and siblings if that makes sense!) .

 

1.  What is the best method to achieve this callout?  (outbound message vs apex callout vs ...?) - I think Apex is the only option?

2.  I have built similar webservice callouts using Apex before but they've always been very simple (send in one or 2 parameters) - How would one go about passing in the array of child objects to the web service? (I have no control over the external end so can't just pass a query string for it to retrieve the records)

 

Any thoughts much appreciated,

 

Demi

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
gm_sfdc_powerdegm_sfdc_powerde

>How would one go about passing in the array of child objects to the web service?

You are right that Apex is the way to go. However, the answer to your question lies in the contract specified by your external web service.  It's not about how you pass it in Apex, it's about the operation and the input data structure defined  by your web service in the WSDL file.  Since you have done callouts before, I hope you are familar with generating Apex stub from the WSDL.  You can look at the generated Apex stubs (or the WSDL itself) to get an idea about this.

 

All Answers

gm_sfdc_powerdegm_sfdc_powerde

>How would one go about passing in the array of child objects to the web service?

You are right that Apex is the way to go. However, the answer to your question lies in the contract specified by your external web service.  It's not about how you pass it in Apex, it's about the operation and the input data structure defined  by your web service in the WSDL file.  Since you have done callouts before, I hope you are familar with generating Apex stub from the WSDL.  You can look at the generated Apex stubs (or the WSDL itself) to get an idea about this.

 

This was selected as the best answer
DemintDemint
Thanks for this (and apologies for the slight dealy in response)!