{"id":1923,"date":"2009-12-22T16:43:40","date_gmt":"2009-12-22T11:43:40","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=1923"},"modified":"2009-12-22T16:46:03","modified_gmt":"2009-12-22T11:46:03","slug":"apex-code-to-invoke-an-external-web-service","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2009\/12\/22\/apex-code-to-invoke-an-external-web-service\/","title":{"rendered":"Apex Code to Invoke an External Web Service"},"content":{"rendered":"<p>To invoke an external service after using its WSDL document to generate an Apex class, create an instance of the stub in your Apex script and call the methods on it. <\/p>\n<p>For example, to invoke the StrikeIron IP address lookup service from Apex, you could write a script similar to the following:<\/p>\n<blockquote><p>\n\/\/ Create the stub<br \/>\nstrikeironIplookup.DNSSoap dns = new strikeironIplookup.DNSSoap();<\/p>\n<p>\/\/ Set up the license header<br \/>\ndns.LicenseInfo = new strikeiron.LicenseInfo();<br \/>\ndns.LicenseInfo.RegisteredUser = new strikeiron.RegisteredUser();<br \/>\ndns.LicenseInfo.RegisteredUser.UserID = &#8216;you@company.com&#8217;;<br \/>\ndns.LicenseInfo.RegisteredUser.Password = &#8216;your-password&#8217;;<\/p>\n<p>\/\/ Make the Web service call<br \/>\nstrikeironIplookup.DNSInfo info = dns.DNSLookup(&#8216;www.myname.com&#8217;); <\/p><\/blockquote>\n<p>Read More @ <a href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_web_services_wsdl2apex.htm\" target=\"_blank\" rel=\"noopener\">Salesforce.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To invoke an external service after using its WSDL document to generate an Apex class, create an instance of the stub in your Apex script and call the methods on it. For example, to invoke the StrikeIron IP address lookup service from Apex, you could write a script similar to the following: \/\/ Create the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[169],"class_list":["post-1923","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-salesforce","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/1923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=1923"}],"version-history":[{"count":3,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/1923\/revisions"}],"predecessor-version":[{"id":1926,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/1923\/revisions\/1926"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=1923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=1923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=1923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}