Skip to main content
Became Hot Network Question
added 2 characters in body
Source Link
Rahul Gawale
  • 12.3k
  • 6
  • 33
  • 70

We are connecting Salesforce from a third-party system, the requirement is to create some named credentials, custom metadata records, and remote site settings from the third-party System after installation of the managed package.

I am trying to create a named credential in Salesforce through SOAP metadata API. I am using Salesforce Platform APIs on Postman. Below is my request body.

Request Body

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata">
    <soapenv:Header>
        <tns:SessionHeader>
            <tns:sessionId>{{_accessToken}}</tns:sessionId>
        </tns:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <tns:createMetadata>
            <tns:metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="tns:NamedCredential">
                <endpoint>https://your.endpoint.url</endpoint>
                <label>endpoint_name</label>
                <principalType>NamedUser</principalType>
                <protocol>Password</protocol>
                <password>actual_password</password>
                <username>[email protected]</username>
            </tns:metadata>
        </tns:createMetadata>
    </soapenv:Body>
</soapenv:Envelope>

This is the response I am getting.   

Response

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <createMetadataResponse>
            <result>
                <fullName xsi:nil="true"/>
                <success>false</success>
            </result>
        </createMetadataResponse>
    </soapenv:Body>
</soapenv:Envelope>

The response does not give any descriptive information about the problem here. I am not able to create the NamedCredential.

What am I doing wrong here?

We are connecting Salesforce from a third-party system, the requirement is to create some named credentials, custom metadata records, and remote site settings from the third-party System after installation of the managed package.

I am trying to create a named credential in Salesforce through SOAP metadata API. I am using Salesforce Platform APIs on Postman. Below is my request body.

Request Body

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata">
    <soapenv:Header>
        <tns:SessionHeader>
            <tns:sessionId>{{_accessToken}}</tns:sessionId>
        </tns:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <tns:createMetadata>
            <tns:metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="tns:NamedCredential">
                <endpoint>https://your.endpoint.url</endpoint>
                <label>endpoint_name</label>
                <principalType>NamedUser</principalType>
                <protocol>Password</protocol>
                <password>actual_password</password>
                <username>[email protected]</username>
            </tns:metadata>
        </tns:createMetadata>
    </soapenv:Body>
</soapenv:Envelope>

This is the response I am getting.  Response

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <createMetadataResponse>
            <result>
                <fullName xsi:nil="true"/>
                <success>false</success>
            </result>
        </createMetadataResponse>
    </soapenv:Body>
</soapenv:Envelope>

The response does not give any descriptive information about the problem here. I am not able to create the NamedCredential.

What am I doing wrong here?

We are connecting Salesforce from a third-party system, the requirement is to create some named credentials, custom metadata records, and remote site settings from the third-party System after installation of the managed package.

I am trying to create a named credential in Salesforce through SOAP metadata API. I am using Salesforce Platform APIs on Postman. Below is my request body.

Request Body

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata">
    <soapenv:Header>
        <tns:SessionHeader>
            <tns:sessionId>{{_accessToken}}</tns:sessionId>
        </tns:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <tns:createMetadata>
            <tns:metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="tns:NamedCredential">
                <endpoint>https://your.endpoint.url</endpoint>
                <label>endpoint_name</label>
                <principalType>NamedUser</principalType>
                <protocol>Password</protocol>
                <password>actual_password</password>
                <username>[email protected]</username>
            </tns:metadata>
        </tns:createMetadata>
    </soapenv:Body>
</soapenv:Envelope>

This is the response I am getting. 

Response

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <createMetadataResponse>
            <result>
                <fullName xsi:nil="true"/>
                <success>false</success>
            </result>
        </createMetadataResponse>
    </soapenv:Body>
</soapenv:Envelope>

The response does not give any descriptive information about the problem here. I am not able to create the NamedCredential.

What am I doing wrong here?

Source Link
Rahul Gawale
  • 12.3k
  • 6
  • 33
  • 70

Named Credential not created through SOAP Metadata API

We are connecting Salesforce from a third-party system, the requirement is to create some named credentials, custom metadata records, and remote site settings from the third-party System after installation of the managed package.

I am trying to create a named credential in Salesforce through SOAP metadata API. I am using Salesforce Platform APIs on Postman. Below is my request body.

Request Body

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://soap.sforce.com/2006/04/metadata">
    <soapenv:Header>
        <tns:SessionHeader>
            <tns:sessionId>{{_accessToken}}</tns:sessionId>
        </tns:SessionHeader>
    </soapenv:Header>
    <soapenv:Body>
        <tns:createMetadata>
            <tns:metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="tns:NamedCredential">
                <endpoint>https://your.endpoint.url</endpoint>
                <label>endpoint_name</label>
                <principalType>NamedUser</principalType>
                <protocol>Password</protocol>
                <password>actual_password</password>
                <username>[email protected]</username>
            </tns:metadata>
        </tns:createMetadata>
    </soapenv:Body>
</soapenv:Envelope>

This is the response I am getting. Response

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <createMetadataResponse>
            <result>
                <fullName xsi:nil="true"/>
                <success>false</success>
            </result>
        </createMetadataResponse>
    </soapenv:Body>
</soapenv:Envelope>

The response does not give any descriptive information about the problem here. I am not able to create the NamedCredential.

What am I doing wrong here?