Just completed some integration work with a partner of ours using the Ruby language. Given that a lot of startups like Ruby I thought it would be useful to cut-n-paste the sample code here.
This example creates a simple (minimal) opportunity using the SOAP API in Sales Cloud. That said the code would be almost identical if you were querying HCM Data,
The approach we took here was to prototype the SOAP call using SOAPUI and then cut-n-paste the SOAP payload into the data variable. In a real industrialized solution I'd create the payloads in template form.
def create_opportunity
# Change yourhostname.com to your Fusion SOAP Endpoint Hostname
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
path = uri.request_uri
http.read_timeout = 5
http.open_timeout = 5
# Change authorization header to contain Base64encoded string of username/password
headers = {
'Content-Type' => 'text/xml',
'soapAction' => 'http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/createOpportunity',
'authorization' => 'Basic bBase64EncodedCredentialHere='
}
# Data Contains the payload
data = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/types/" xmlns:opp="http://xmlns.oracle.com/apps/sales/opptyMgmt/opportunities/opportunityService/" xmlns:rev="http://xmlns.oracle.com/apps/sales/opptyMgmt/revenues/revenueService/" xmlns:not="http://xmlns.oracle.com/apps/crmCommon/notes/noteService" xmlns:not1="http://xmlns.oracle.com/apps/crmCommon/notes/flex/noteDff/" xmlns:rev1="http://xmlns.oracle.com/oracle/apps/sales/opptyMgmt/revenues/revenueService/" xmlns:act="http://xmlns.oracle.com/apps/crmCommon/activities/activitiesService/">
<soapenv:Header/>
<soapenv:Body>
<typ:createOpportunity>
<typ:opportunity>
<opp:Name>Joel Test New1</opp:Name>
</typ:opportunity>
</typ:createOpportunity>
</soapenv:Body>
</soapenv:Envelope>'
resp, data = http.post(path, data, headers)
end
|
!TIP!
|
A quick test in a SOAP testing tool like JDevelopers Http Analyzer or SOAPUI is a MUST before executing this!
|
It's a nice article, Which you have shared here about the calling fusion. Your article is very informative and I really liked the way you expressed your views in this post. Thank you. Oracle Manufacturing Cloud training in bangalore
ReplyDeleteYour blog is really good. This information is really useful for those who have searched for this and you have great knowledge about this. I’m really impressed with your post. Business Procedures Software
ReplyDelete