Memos About Salesforce

Salesforceにハマってたこと!

Salesforce PartnerWSDL データ連携

f:id:jude2016:20200225160312p:plain
Salesforce WSDLダウンロード画面イメージ

こんにちは、管理人の@Salesforce.Zです。

データ連携では、WSDLファイルによって、ログインフローをより便利にできる。

Salesforce設定では、このようなファイルを簡単にダウンロードし、使えます。

読んだら得ること

★ PartnerWSDLファイルで本番とSandboxへのログイン定義

目次

PartnerWSDL

複数の組織のためのクライアントアプリケーションを構築しているお客様、パートナー、および ISV 向けに大まかに作成された WSDL。これを使用して、組織内でデータにアクセスできます。

対象環境からファイルをダウンロードし加工する

ダウンロードしたサンプル

<?xml version="1.0" encoding="UTF-8"?>
<!--
Salesforce.com Partner Web Services API Version 48.0
Generated on 2020-02-25 07:00:28 +0000.

Copyright 1999-2020 salesforce.com, inc.
All Rights Reserved
-->

<definitions targetNamespace="urn:partner.soap.sforce.com"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:fns="urn:fault.partner.soap.sforce.com"
             xmlns:tns="urn:partner.soap.sforce.com"
             xmlns:ens="urn:sobject.partner.soap.sforce.com">

中間は略します。。。

    <!-- Soap Service Endpoint -->
    <service name="SforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="Soap">
            <soap:address location="https://login.salesforce.com/services/Soap/u/48.0"/>
        </port>
    </service>

サンプルを加工する

サービスのところを加工すれば、PartnerWSDLファイルを使用時にサービスを切り替えることによって 本番か、Sandboxかを選択できます。

WebServiceの設定では、サービスやポートの選択オプションOR値の設定をこれらの加工したサービス名とポート名にすることです。

<?xml version="1.0" encoding="UTF-8"?>
<!--
Salesforce.com Partner Web Services API Version 48.0
Generated on 2020-02-25 07:00:28 +0000.

Copyright 1999-2020 salesforce.com, inc.
All Rights Reserved
-->

<definitions targetNamespace="urn:partner.soap.sforce.com"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:fns="urn:fault.partner.soap.sforce.com"
             xmlns:tns="urn:partner.soap.sforce.com"
             xmlns:ens="urn:sobject.partner.soap.sforce.com">

中間は略します。。。

    <!--For Product Soap Service Endpoint -->
    <service name="ProductSforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="ProductSoap">
            <soap:address location="https://login.salesforce.com/services/Soap/u/47.0"/>
        </port>
    </service>
    <!-- For Sandbox Soap Service Endpoint -->
    <service name="SandboxSforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="SandboxSoap">
            <soap:address location="https://test.salesforce.com/services/Soap/u/47.0" />
        </port>
    </service>

終わりに

いろいろ、お試してください。でないと、分からないところもあると思います。

Salesforce WSDL およびクライアント認証証明書のダウンロード