Skip to Content
Author's profile photo Jerry Wang

Step by step to consume standard C4C web service via SoapUI

Hello all,
I am really a newbie to Cloud for Customer world and this is my first blog, very simple but I hope it can help some other newbies just the same as me.
I have been working as an application developer in SAP CRM for 5 years, and in CRM we have dedicated work center to create web service based on CRM standard business object.
Just a quick glance at the modeling UI in CRM.
and now I have to do the same in C4C, let’s say I would like to query C4C Opportunity transaction data in my custom application using standard web service provided in C4C. In order to test this consumption, I choose SoapUI.
Here below is detailed step by step screenshot.
1. Go to workcenter Administrator, then Input and Output management->Service Explorer, you can get a list of all standard inbound services here.
Download the WSDL for later use.
If you are working in 1605, you can find a list of all standard web services from SAP help:
Since I would like to query Opportunity data, I choose QueryOpportunityIn, and click “Show full documentation”:
The documentation tells me how to fill the request detail in SoapUI.
2. Download and install SoapUI. Create a new SOAP project by loading the WSDL downloaded from previous step.
Suppose I would like to retrieve this opportunity data in my C4C system by querying its id:
Of source this example might not make much sense from business perspective as in real world we tend to use other criteria like customer name to query Opportunity.
Paste the following xml source code in request view to query on Opportunity 15360.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:zzz="http://sap.com/xi/AP/CustomerExtension/BYD/ZZZZZ">
   <soapenv:Header/>
   <soapenv:Body>
      <glob:OpportunityByElementsQuery_sync_V1>
         <!--Optional:-->
         <OpportunitySelectionByElements>
            <!--Zero or more repetitions:-->
            <SelectionByIdentifier>
               <!--Optional:-->
               <InclusionExclusionCode>I</InclusionExclusionCode>
               <IntervalBoundaryTypeCode>1</IntervalBoundaryTypeCode>
               <!--Optional:-->
               <LowerBoundaryIdentifier>15360</LowerBoundaryIdentifier>
            </SelectionByIdentifier>
         </OpportunitySelectionByElements>
      </glob:OpportunityByElementsQuery_sync_V1>
   </soapenv:Body>
</soapenv:Envelope>

Execute this request, I meet with error message: 401 Unauthorized.
Then I manually maintained my business user and password in request property view:
You might also need to maintain proxy setting for SoapUI according to your network landscape.
Once you have finished all such settings, execute request again and now you can see response as expected:

Update 2017-11-29

In case you meet with error message “Authorization role missing” when consuming web service, you might refer to this blog for help: How to resolve error message when calling Web Service in SoapUI – Authorization role missing

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Jerry,

      It is a great job.I want to know how to enhance the fiori applications on the SAP Business ByDesign or SAP Cloud for Customer, thank you very much!

       

      Jack.Hua

      Best Regard

      Author's profile photo Daniel Krause
      Daniel Krause

       

      Thanks Jerry, great job. Had the same topic today and you saved me a lot of time.

       

      Best regards,

      Daniel

      Author's profile photo Former Member
      Former Member

      Thanks Jerry.

      Is there any similar document for Maintain Web service illustrating either Update or Delete?

      I am looking forward for Leads - MangeMarketingLeadsIn and facing the issue. Issue is that the existing customer is not being identified.

      If you are aware of this. Please guide.

       

      Thanks,

      Srihari.

      Author's profile photo Former Member
      Former Member

      Hi All,

      I am facing the below issue when I use Manage service WSDL from SOAP UI:

      Here, I am trying to create a Lead for Existing BP in the system.

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global" xmlns:yh2="http://0003865926-one-off.sap.com/YH27FMJUY_">
         <soapenv:Header/>
         <soapenv:Body>
            <glob:MarketingLeadBundleMaintainRequest_sync>
               <!--1 or more repetitions:-->
               <MarketingLead actionCode="01">
                  <!--Optional:-->
                  <ObjectNodeSenderTechnicalID>SOAP_Lead_Test</ObjectNodeSenderTechnicalID>
      		  <!--Optional:-->
                  <Name>SOAP Lead Test</Name>
                  <!--Optional:-->
                  <ProcessingTypeCode></ProcessingTypeCode>
                  <!--Optional:-->
                  <!--<OriginTypeCode listID="?" listVersionID="?" listAgencyID="?" listAgencySchemeID="?" listAgencySchemeAgencyID="?">?</OriginTypeCode>
      -->
                  <!--Optional:-->
                  <GroupCode>Z3</GroupCode>
                  <!--Optional:-->
                  <PriorityCode>3</PriorityCode>
                  <!--Optional:-->
                  <StatusCode></StatusCode>
                  <!--Optional:-->
                  <EmployeeInternalID>8000000196</EmployeeInternalID>
                  <!--Optional:-->
                  <!--<Note>?</Note>
      -->
                  <!--Optional:-->
                  <!--<UseExistingAccountContactIndicator>?</UseExistingAccountContactIndicator>
      -->
                  <!--Optional:-->
                  <PersonFirstName>Lead History check</PersonFirstName>
                  <!--Optional:-->
                  <PersonLastName>Lead History check</PersonLastName>
                  <!--Optional:-->
                  <PersonMiddleName>Lead History check</PersonMiddleName>
                  <!--Optional:-->
                  <IndividualCustomerGivenName>Lead History check</IndividualCustomerGivenName>
                  <!--Optional:-->
                  <IndividualCustomerFamilyName>Lead History check</IndividualCustomerFamilyName>
                  <!--Optional:-->
                  <IndividualCustomerMiddleName>Lead History check</IndividualCustomerMiddleName>
                  <!--Optional:-->
                  <IndividualCustomerInitialsName>Lead History check</IndividualCustomerInitialsName>
                  <!--Optional:-->
                  <ProspectParty actionCode="06" >
                     <!--Optional:-->
                     <AccountInternalID></AccountInternalID>
                     <!--Optional:-->
                     <InactiveAccountInternalID></InactiveAccountInternalID>
                     <!--Optional:-->
                     <MainContactPersonInternalID></MainContactPersonInternalID>
                     <!--Optional:-->
                     <InactiveMainContactPersonInternalID></InactiveMainContactPersonInternalID>
                     <!--Optional:-->
                     <AccountExternalKey>
                        <!--Optional:-->
                        <!--<CommunicationSystemID schemeID="?" schemeAgencyID="?">?</CommunicationSystemID>
      -->
                        <!--Optional:-->
                        <RemoteObjectID schemeID="?" schemeVersionID="?" schemeAgencyID="?" >7000001439</RemoteObjectID>
                     </AccountExternalKey>
                     <!--Zero or more repetitions:-->
                     <!--<ContactParty actionCode="06">
                        <ObjectNodeSenderTechnicalID></ObjectNodeSenderTechnicalID>
                        <ContactPersonInternalID></ContactPersonInternalID>
        			   <ContactExternalKey>
                           <CommunicationSystemID schemeID="?" schemeAgencyID="?">?</CommunicationSystemID>
                           <RemoteObjectID schemeID="?" schemeVersionID="?" schemeAgencyID="?">?</RemoteObjectID>
                        </ContactExternalKey>
                     </ContactParty>
      -->
                     <!--Optional:-->
                     <DefaultContactExternalKey>
                        <!--Optional:-->
                        <!--<CommunicationSystemID schemeID="?" schemeAgencyID="?">?</CommunicationSystemID>
      -->
                        <!--Optional:-->
                        <!--<RemoteObjectID schemeID="?" schemeVersionID="?" schemeAgencyID="?">?</RemoteObjectID>
      -->
                     </DefaultContactExternalKey>
                  </ProspectParty>
                  <!--Optional:-->
                  <yh2:DeclineDateEx></yh2:DeclineDateEx>
                  <!--Optional:-->
                  <yh2:LeadContractAccountIDEx>900010848071</yh2:LeadContractAccountIDEx>
                  <!--Optional:-->
                  <yh2:TransferDateEx></yh2:TransferDateEx>
                  <!--Optional:-->
                  <yh2:PoliciesCancelled></yh2:PoliciesCancelled>
               </MarketingLead>
            </glob:MarketingLeadBundleMaintainRequest_sync>
         </soapenv:Body>
      </soapenv:Envelope>

       

      I am getting the error:

      <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
         <soap-env:Header/>
         <soap-env:Body>
            <n0:MarketingLeadBundleMaintainConfirmation_sync xmlns:n0="http://sap.com/xi/SAPGlobal20/Global" xmlns:prx="urn:sap.com:proxy:LP4:/1SAI/TAEC08D44E1498DB2599D27:804">
               <Log>
                  <MaximumLogItemSeverityCode>3</MaximumLogItemSeverityCode>
                  <Item>
                     <TypeID>039(/MBF_A2X_CORE/)</TypeID>
                     <CategoryCode>BPR.PUR</CategoryCode>
                     <SeverityCode>3</SeverityCode>
                     <ReferenceObjectNodeSenderTechnicalID>SOAP_Lead_Test</ReferenceObjectNodeSenderTechnicalID>
                     <Note>Action code 01 in segment LEAN_LEAD contradicts action code 06 in segment LEAN_LEAD-PROSPECT_PARTY</Note>
                  </Item>
               </Log>
            </n0:MarketingLeadBundleMaintainConfirmation_sync>
         </soap-env:Body>
      </soap-env:Envelope>

      Please suggest.

       

      Thanks,

      Srihari.

      Author's profile photo Measum Kumail
      Measum Kumail

      Hi Jarry,

      I am facing one problem that I have added a custom field using a KUT (Adapt menu) in my ticket screen. I have added this field in the standard API. now whenever I use its WSDL in SOAPUI, this custom field is not showing in the results after submitting my entries via SOAPUI.

       

      Seems custom field added via KUT cannot be extracted via standard APIs and we need to develop custom API via visual studio.