0

Got a weird one.

I created a Named Credential and an associated External Credential.

I documented this extensively and noted down exactly what I used in each field... The external credential was configured with Authentication Protocol == "Basic".

I created a custom class and filled in the Username and Password as follows

public String endpoint_x = 'callout:NAMED_CRED';
private final SecuritySOAP Security = new SecuritySOAP('{!$Credential.Username}', '{!$Credential.Password}');
private final String Security_hns = 'Security=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';

This was working all last week. The code was generated at API v59.0.

I refreshed my sandbox today and was trying to re-deploy my code + Credential information but now I'm getting the error Error parsing file: 'Basic' is not a valid value for the enum 'AuthenticationProtocol' (line:3)

I went out to my Sandbox to manually create the Named Creds but, magically Basic is no longer an option (as the error suggests). I recreated it with Custom as the Authentication Protocol, but now my Username and Password is blank.

This past week, my XML SOAP Envelope looked like the following. Notice the #### lines.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Header>
      <Security
       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
       xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <UsernameToken>
          #### <Username>FooName1</Username>
          #### <Password>BarPassword2</Password>
          <Nonce>LTQyNDM1MDMwNjIwNzM1MjUwNjQ=</Nonce>
          <wsu:Created>2024-02-05 03:47:47</wsu:Created>
         </UsernameToken>
      </Security>
   </env:Header>
 <env:Body>
  <GetProviders xmlns="https://www.SOAPURL.com/dsi" />
 </env:Body>
</env:Envelope>

Now, it looks like this after the refresh. Pay attention to #### lines again

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <env:Header>
      <Security
       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
       xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <UsernameToken>
          <UsernameToken>
            #### <Username></Username>
            #### <Password></Password>
            <Nonce>NDIxNDAxODgwMjI2OTQwOTg5NA==</Nonce>
            <wsu:Created>2024-02-09 07:59:48</wsu:Created>
          </UsernameToken>
         </UsernameToken>
      </Security>
   </env:Header>
 <env:Body>
  <GetProviders xmlns="https://www.SOAPURL.com/dsi" />
 </env:Body>
</env:Envelope>

Am I missing something? Did I hallucinate how this was done previously? Am I looking in the wrong place? Someone please shine some light here....

4
  • 2
    Pretty sure Basic is new in Spring 24 - but the sandbox is most likely a non-preview, so still on Winter 24. Check which release each org is on to see which versions each has. Commented Feb 9 at 17:37
  • 1
    The comment above is correct re: likely root cause. It's worth noting that using Basic as the config option when your auth method is anything but (it happens to be WS-Security) is asking for trouble. You can use NC/EC for credential vaulting, sure but take care of the details. Lots of Q&As on this topic here.
    – identigral
    Commented Feb 9 at 19:17
  • 1
    @BritishBoyinDC - thanks! that makes so much sense. I'm assuming my sandbox was on Spring 24 as preview before I refreshed. I've had that happen in the past where it's on the Preview version, refresh, then it's back to current release version. But makes sense if Basic is new in Spring 24. Thanks again. Commented Feb 10 at 15:30
  • @identigral could you expand on why it's asking for trouble? I've never integrated with a SOAP api and I'm learning about WS-Security as I go. I'm essentially only using NC/EC for credential vaulting as you mention. Just keeping the creds there to provide additional security vs having them hard coded in a Custom Metadata/Setting. Basic is the only way I've found to be able to grab the creds during the SOAP callout. Commented Feb 10 at 15:32

1 Answer 1

0

Just to provide an answer, @BritishBoyinDC was correct that Basic was new in Spring 24. My initial development must have been on a sandbox that was in preview and I spun up a feature that was brand new and didn't realize...

After waiting the weekend, Basic was showing up as a valid option for NC/EC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .