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
Intelligence PartnerIntelligence Partner 

Apex SOAP webservice authentication with UsernameToken

We have generated an apex SOAP web service that must be invoked from an external system. By request of the external system the request must be made in a single step (using UsernameToken, including username and password in the header of the call).
If I try to test using SOAPui, it returns:
sf:INVALID_SESSION_ID
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
This  article describes how to perform using a Marketing Cloud user: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/authenticate-soap-api.htm (https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/authenticate-soap-api.htm)
What configuration must be done to configure it with a user with a Salesforce license? Can it be replicated for a user with a Salesforce license?
 
Naren9Naren9
Hi,
Have you tried to login to Salesforce through SOAP UI by using the Enterprise or Partner WSDL?.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_login.htm
In the First Call, you will get the Session Id and in Subsequent call, use the Session Id.

Thanks,
Naren
 
Intelligence PartnerIntelligence Partner
Hello, 
It is not possible to use the Session Id, the client requests a SOAP webservice in which includes username and password inside the header request:
<soap:header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <UsernameToken>
        <Username>XXXXX</Username>
        <Password>XXXXX</Password>
    </UsernameToken>
</Security>
</soap:header>
Thank you