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
RajiSrinivasanRajiSrinivasan 

Creating SOAP Request in Apex

I am trying to call a web service in PeopleSoft from salesforce (Apex class). The service requires a SOAP XML request with necessary security (username and password) in SOAP header.

 

I generated Apex classes from the WSDL following this document.

http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts

 

But there is not an option to create a SOAP request using the classes generated from WSDl2Apex.

 

Is it possible to create a complete SOAP XML HTTP request to call an external web service from an Apex class?

Is it possible to use the standard SOAP APIs in Apex to create a complete SOAP XML request in a Apex class?

 

Thanks,

Raji

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
UVUV

All Answers

UVUV
This was selected as the best answer
RajiSrinivasanRajiSrinivasan

Thanks for your prompt response.

That is the best alternative/workaround for making callouts to a SOAP web service.

 

I have created the entire SOAP request including the SOAP Header as a string  and sending it over Http. 

UVUV

Pls mark that as a solution for the other's benifit..

jorge martinez 27jorge martinez 27
I need to do a http post with this xml:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <Authentication xmlns="http://www.***.com/WebServices">
      <User>string</User>
      <Password>string</Password>
      <TwoFactorDeviceId>string</TwoFactorDeviceId>
    </Authentication>
  </soap:Header>
  <soap:Body>
    <CreateCustomer xmlns="http://www.***.com/WebServices">
      <input>
        <CustomerAccountAddress>
          <FirstName>string</FirstName>
          <LastName>string</LastName>
          <CompanyName>string</CompanyName>
          <Title>string</Title>
          <Phone>string</Phone>
        </CustomerAccountAddress>
        <CustomerAccountEmail>string</CustomerAccountEmail>
        <CustomerAccountPhone>string</CustomerAccountPhone>
        <DealerCustomerId>string</DealerCustomerId>
        <DesiredLoginName>string</DesiredLoginName>
        <DesiredPassword>string</DesiredPassword>
        <InstallationAddress>
          <Street1>string</Street1>
          <Street2>string</Street2>
          <SubCity>string</SubCity>
          <City>string</City>
          <SubState>string</SubState>
          <State>string</State>
          <Zip>string</Zip>
          <CountryId>NotSet </CountryId>
        </InstallationAddress>
        <InstallationTimeZone>NotSet</InstallationTimeZone>
        <Culture>Unknown </Culture>
        <PanelType>NotSet </PanelType>
        <PanelVersion>Other </PanelVersion>
        <ModemSerialNumber>string</ModemSerialNumber>
        <UnitDescription>string</UnitDescription>
        <panelSettingTemplateId>int</panelSettingTemplateId>
        <InstallerCode>string</InstallerCode>
        <CsEventGroupsToForward>
          <CentralStationEventGroupEnum>NotSet </CentralStationEventGroupEnum>
          <CentralStationEventGroupEnum>NotSet </CentralStationEventGroupEnum>
        </CsEventGroupsToForward>
        <PhoneLinePresent>boolean</PhoneLinePresent>
        <CentralStationForwardingOption>NotSet or Never or Always or OnlyIfPhoneFails</CentralStationForwardingOption>
        <CentralStationAccountNumber>string</CentralStationAccountNumber>
        <CentralStationReceiverNumber>string</CentralStationReceiverNumber>
        <PackageId>int</PackageId>
        <AddOnFeatures>
          <AddOnFeatureEnum>VoiceNotificationsForAlarms</AddOnFeatureEnum>
          <AddOnFeatureEnum>VoiceNotificationsForAlarms </AddOnFeatureEnum>
        </AddOnFeatures>
        <IgnoreLowCoverageErrors>boolean</IgnoreLowCoverageErrors>
        <BranchId>int</BranchId>
        <LeadId>int</LeadId>
        <CustomerNotifications>
          <CustomerNotificationEnum>Alarms</CustomerNotificationEnum>
          <CustomerNotificationEnum>Alarms</CustomerNotificationEnum>
        </CustomerNotifications>
        <LoginNameAtAuthenticationProvider>string</LoginNameAtAuthenticationProvider>
        <PropertyType>NotSet </PropertyType>
        <SalesRepLoginName>string</SalesRepLoginName>
        <InstallerLoginName>string</InstallerLoginName>
        <ContractLengthInMonths>int</ContractLengthInMonths>
        <ContractEndDate>dateTime</ContractEndDate>
        <EnrolledInMaintenance>boolean</EnrolledInMaintenance>
        <PackageTemplateId>int</PackageTemplateId>
        <HasInsuranceFeatures>boolean</HasInsuranceFeatures>
      </input>
    </CreateCustomer>
  </soap:Body>
</soap:Envelope>






but i don't  how to do it, can you help me?