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
brianogreenebrianogreene 

Questions from an Apex Web Service Beginner - Any feedback will be appreciated

I'm integrating Salesforce opportunities to an internal network enterprise application.  To enable this integration (Apex Callout), will the enterprise application or target middleware need to be exposed to the internet?  If so, what is the best way to do this?

 

Also, I will need to create a Salesforce Web Service which can be called by the internal application.  I have created a sample one that works, however; my internal development partner would like me to modify the resulting WSDL to accept data in the exact format they are currently publishing it.  They have a company standard I need to adapt.  Without introducing middleware, is it possible for me to modify my web service to accept "exactly" what they are sending?  Also, is their any way I cannot require them to execute the Login method and retrieve a Session ID or is this always required?

 

I have a sample of their xml if that helps.

 

Any feedback will be appreciated!

 

Thanks!

JoeK.ax278JoeK.ax278

 

Hello, Brian, 

 

You are correct to think early about and plan for making the services you call accessible over the internet.   Except for already-public web services, this usually requires that the IT group for the organization that runs the services change their firewall config to allow Salesforce in.  You'll have to track down the security folks responsible for this.  It might sound scary to them at first, but it's been done in all kinds of very sercurity conscious companies, so patient explanations are the best strategy if you get resistance.

 

Two other security-related details that sometimes trip up SF calls to web services:   (1) In addition to production services, you might also need to access test and/or development services from Salesforce during development, and (2) When running SSL you must have valid certificates for each server -- you can't get away with reusing a production cert on a development server.

 

Be sure to study the limitations on SF SOAP callouts carefully.  These are well-documented in the Apex manual.

 

As for customizing SF hosted web services, you do have pretty good control over the structure of the SOAP body (not the headers) that SF will expect by defining an appropriate hierarchy of inner classes.  If you can post an actual SOAP message and the schema, that would help folks here to guess whether it's achievable.

 

The incoming call must have the Session Id in the header -- there might be some creative alternatives, but the first and best alternative is to get the id via a call to the login service.  Why does the client service wish to avoid this?

 

Hope this is helpful! 

 

Think & Enjoy -- JoeK

 

 

 

brianogreenebrianogreene

JoeK,

 

Thanks for your reply. I have posted an example of the XML I will be receiving below.  I would appreciate any example you have of creating inner classes to match this schema.  I'm looking for something to get me started.  I will keep playing around until I get it right.

 

<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by Sharon Garvine (Siebel Systems, Inc.) -->
<CRMQuoteToSiebelService_Input>
 <sendQuoteToSiebelRequest>
  <quoteId>0000100215</quoteId>
  <quoteRevisionId>0000100215</quoteRevisionId>
  <quoteName>ABC</quoteName>
  <quoteType>ABC</quoteType>
  <quoteStatus>OPEN</quoteStatus>
  <quoteCreatedDT>09/18/2009 09:52:31</quoteCreatedDT>
  <quoteCreatedBy>TSTDEMO1</quoteCreatedBy>
  <quoteUpdatedDT>10/20/2009 16:31:38</quoteUpdatedDT>
  <quoteUpdatedBy>ABC</quoteUpdatedBy>
  <quoteDateValidFrom>09/18/2009</quoteDateValidFrom>
  <quoteDateValidTo>12/18/2009</quoteDateValidTo>
  <quoteCurrencyCd>USD</quoteCurrencyCd>
  <quoteExchRate>1.0</quoteExchRate>
  <quotePayTerms>ABC</quotePayTerms>
  <quoteOptyId>1-8RYM8</quoteOptyId>
  <quoteOptyName>ABC</quoteOptyName>
  <quoteOptySource/>
  <quoteOptySlsStage>03</quoteOptySlsStage>
  <quoteOptyCommitFlg>Y</quoteOptyCommitFlg>
  <quoteContractNum/>
  <quoteContractRcvDt>00/00/0000</quoteContractRcvDt>
  <quoteContractContingency/>
  <quoteRevDurMonths>00</quoteRevDurMonths>
  <quoteRevStartDt>00/00/0000</quoteRevStartDt>
  <quoteRplcPrgCredReq/>
  <quoteMcKCapital/>
  <quoteSelfSvcContract/>
  <quoteORGDivision>ABC</quoteORGDivision>
  <quoteORGSlsOrg>ABC</quoteORGSlsOrg>
  <quoteOwner>
   <partnerNo/>
  </quoteOwner>
  <quoteSalesTeam>
   <partnerNo>ABC</partnerNo>
  </quoteSalesTeam>
  <quoteSalesTeam>
   <partnerNo>ABC</partnerNo>
  </quoteSalesTeam>
  <quoteAcctSoldToParty>
   <partnerNo>ABC</partnerNo>
  </quoteAcctSoldToParty>
  <quoteAcctShipToParty>
   <partnerNo>ABC</partnerNo>
  </quoteAcctShipToParty>
  <quoteAcctBillToParty>
   <partnerNo>ABC</partnerNo>
  </quoteAcctBillToParty>
  <quoteAcctPayorParty>
   <partnerNo>ABC</partnerNo>
  </quoteAcctPayorParty>
  <quoteFacilities>
   <partnerNo>ABC</partnerNo>
  </quoteFacilities>
  <quoteFacilities>
   <partnerNo>ABC</partnerNo>
  </quoteFacilities>
  <quoteLineItems>
   <lineItemNumber>ABC</lineItemNumber>
   <lineItemParntNumber>ABC</lineItemParntNumber>
   <lineItemType>ABC</lineItemType>
   <itemProdId>ABC</itemProdId>
   <itemQty>ABC</itemQty>
   <itemUOM>ABC</itemUOM>
   <itemCalcListPrice>ABC</itemCalcListPrice>
   <itemDiscPct>ABC</itemDiscPct>
   <itemDiscAmt>ABC</itemDiscAmt>
   <itemNetPrice>ABC</itemNetPrice>
   <itemSoldAsTerm/>
   <itemTerm/>
   <itemTermMeasure/>
   <itemBillPlanCd/>
   <itemBillPlanName/>
   <itemRateBasedPrice/>
   <itemEducNumStudents>0.0</itemEducNumStudents>
   <itemEducUnits/>
   <itemExtendDescr>ABC</itemExtendDescr>
   <itemPayTerms>ABC</itemPayTerms>
   <itemBrkXTiers/>
   <itemMinChgAmt>ABC</itemMinChgAmt>
   <itemOvgAmt>0.0</itemOvgAmt>
   <itemProfitCtr>ABC</itemProfitCtr>
   <orgProdRevGrp>ABC</orgProdRevGrp>
   <orgSolutionSet>ABC</orgSolutionSet>
   <lineItemProductDescr>ABC</lineItemProductDescr>
   <productType>ABC</productType>
   <productSubType>ABC</productSubType>
   <productName>ABC</productName>
   <productLegalName/>
   <productSchedule/>
   <productOrdFlg/>
   <itemAcctSoldToParty>
    <partnerNo/>
   </itemAcctSoldToParty>
   <itemAcctShipToParty>
    <partnerNo/>
   </itemAcctShipToParty>
   <itemAcctBillToParty>
    <partnerNo/>
   </itemAcctBillToParty>
   <itemAcctPayorParty>
    <partnerNo/>
   </itemAcctPayorParty>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
  </quoteLineItems>
  <quoteLineItems>
   <lineItemNumber>0000000101</lineItemNumber>
   <lineItemParntNumber>ABC</lineItemParntNumber>
   <lineItemType>ABC</lineItemType>
   <itemProdId>ABC</itemProdId>
   <itemQty>ABC</itemQty>
   <itemUOM>ABC</itemUOM>
   <itemCalcListPrice>0.0</itemCalcListPrice>
   <itemDiscPct>50.0</itemDiscPct>
   <itemDiscAmt>0.0</itemDiscAmt>
   <itemNetPrice>0.0</itemNetPrice>
   <itemSoldAsTerm/>
   <itemTerm/>
   <itemTermMeasure/>
   <itemBillPlanCd/>
   <itemBillPlanName/>
   <itemRateBasedPrice/>
   <itemEducNumStudents>0.0</itemEducNumStudents>
   <itemEducUnits/>
   <itemExtendDescr/>
   <itemPayTerms>A000</itemPayTerms>
   <itemBrkXTiers/>
   <itemMinChgAmt>0.0</itemMinChgAmt>
   <itemOvgAmt>0.0</itemOvgAmt>
   <itemProfitCtr>ABC</itemProfitCtr>
   <orgProdRevGrp>ABC</orgProdRevGrp>
   <orgSolutionSet>6412</orgSolutionSet>
   <lineItemProductDescr>ABC</lineItemProductDescr>
   <productType>ABC</productType>
   <productSubType>ABC</productSubType>
   <productName>ABC</productName>
   <productLegalName/>
   <productSchedule/>
   <productOrdFlg/>
   <itemAcctSoldToParty>
    <partnerNo/>
   </itemAcctSoldToParty>
   <itemAcctShipToParty>
    <partnerNo/>
   </itemAcctShipToParty>
   <itemAcctBillToParty>
    <partnerNo/>
   </itemAcctBillToParty>
   <itemAcctPayorParty>
    <partnerNo/>
   </itemAcctPayorParty>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
  </quoteLineItems>
  <quoteLineItems>
   <lineItemNumber>ABC</lineItemNumber>
   <lineItemParntNumber>ABC</lineItemParntNumber>
   <lineItemType>ABC</lineItemType>
   <itemProdId>ABC</itemProdId>
   <itemQty>ABC</itemQty>
   <itemUOM>ABC</itemUOM>
   <itemCalcListPrice>0.0</itemCalcListPrice>
   <itemDiscPct>50.0</itemDiscPct>
   <itemDiscAmt>0.0</itemDiscAmt>
   <itemNetPrice>0.0</itemNetPrice>
   <itemSoldAsTerm/>
   <itemTerm/>
   <itemTermMeasure/>
   <itemBillPlanCd/>
   <itemBillPlanName/>
   <itemRateBasedPrice/>
   <itemEducNumStudents>0.0</itemEducNumStudents>
   <itemEducUnits/>
   <itemExtendDescr/>
   <itemPayTerms>A000</itemPayTerms>
   <itemBrkXTiers/>
   <itemMinChgAmt>0.0</itemMinChgAmt>
   <itemOvgAmt>0.0</itemOvgAmt>
   <itemProfitCtr>ABC</itemProfitCtr>
   <orgProdRevGrp>ABC</orgProdRevGrp>
   <orgSolutionSet>ABC</orgSolutionSet>
   <lineItemProductDescr>ABC</lineItemProductDescr>
   <productType>ABC</productType>
   <productSubType>ABC</productSubType>
   <productName>ABC</productName>
   <productLegalName/>
   <productSchedule/>
   <productOrdFlg/>
   <itemAcctSoldToParty>
    <partnerNo/>
   </itemAcctSoldToParty>
   <itemAcctShipToParty>
    <partnerNo/>
   </itemAcctShipToParty>
   <itemAcctBillToParty>
    <partnerNo/>
   </itemAcctBillToParty>
   <itemAcctPayorParty>
    <partnerNo/>
   </itemAcctPayorParty>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
   <productSpecialist>
    <partnerNo>ABC</partnerNo>
   </productSpecialist>
  </quoteLineItems>  
 </sendQuoteToSiebelRequest>
</CRMQuoteToSiebelService_Input>

 

Thanks,