SOAP XML 요청 및 응답 헤더

이 페이지에서는 필수 SOAP XML 요청 헤더와 응답으로 반환되는 헤더에 대한 정보를 제공합니다.

필수 요청 헤더

모든 API SOAP 호출에는 헤더에 <RequestHeader> 요소가 있어야 합니다. 이 요소는 모든 서비스 WSDL에 정의되어 있습니다. 클라이언트 라이브러리는 제공하는 값을 사용하여 이 헤더를 자동으로 추가하는 메서드를 제공합니다. 다음은 <RequestHeader>의 모든 요소에 대한 설명입니다.

요소 설명
<networkCode>

주소를 지정하는 네트워크의 네트워크 코드입니다. NetworkService.getAllNetworks()NetworkService.makeTestNetwork()를 제외한 모든 요청을 실행할 때 네트워크 코드가 필요합니다.

계정 로그인에 사용할 수 있는 네트워크 코드만 사용하세요. 계정의 Google Ad Manager 웹사이트에서 관리 > '네트워크 코드' 옆에 있는 네트워크 설정 페이지

<applicationName> 애플리케이션을 식별하는 임의의 문자열 이름입니다. 이는 Google의 로그 파일에 표시됩니다. 예를 들면 'My Inventory Application' 또는 'App_1'입니다.

참고: 애플리케이션에서 Ad Manager API로 전송하는 모든 요청에는 OAuth2 액세스 토큰이 포함되어야 합니다. 토큰을 Authorization: Bearer YOUR_ACCESS_TOKEN로 HTTP 헤더로 전달합니다.

요청 예

다음 코드는 루트 AdUnit를 찾는 getAdUnitsByStatement()에 대한 SOAP 요청 호출의 예입니다.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <ns1:RequestHeader
         soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
         soapenv:mustUnderstand="0"
         xmlns:ns1="https://www.google.com/apis/ads/publisher/v202508">
      <ns1:networkCode>123456</ns1:networkCode>
      <ns1:applicationName>DfpApi-Java-2.1.0-dfp_test</ns1:applicationName>
    </ns1:RequestHeader>
  </soapenv:Header>
  <soapenv:Body>
    <getAdUnitsByStatement xmlns="https://www.google.com/apis/ads/publisher/v202508">
      <filterStatement>
        <query>WHERE parentId IS NULL LIMIT 500</query>
      </filterStatement>
    </getAdUnitsByStatement>
  </soapenv:Body>
</soapenv:Envelope>

참고: SOAP 요청으로 인해 Unmarshalling error이 발생하는 경우 일반적인 오류에서 문제해결 도움말을 참조하세요.

응답 헤더

API에서 반환되는 모든 응답에는 다음 헤더 요소가 포함됩니다. 권장사항에 따라 이러한 값을 로깅하는 것이 좋습니다.

요소 설명
<requestId> 이 요청을 고유하게 식별합니다. 지원 문제가 있는 경우 이 ID를 사용하면 요청을 보다 쉽게 찾을 수 있습니다.
<responseTime> 웹 서비스에서 요청을 수신한 후 있습니다.

응답 예시

다음 코드는 이전 요청에 대한 SOAP 응답의 예를 보여줍니다.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v202508">
      <requestId>xxxxxxxxxxxxxxxxxxxx</requestId>
      <responseTime>1063</responseTime>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
    <getAdUnitsByStatementResponse xmlns="https://www.google.com/apis/ads/publisher/v202508">
      <rval>
        <totalResultSetSize>1</totalResultSetSize>
        <startIndex>0</startIndex>
        <results>
          <id>2372</id>
          <name>RootAdUnit</name>
          <description></description>
          <targetWindow>TOP</targetWindow>
          <status>ACTIVE</status>
          <adUnitCode>1002372</adUnitCode>
          <inheritedAdSenseSettings>
            <value>
              <adSenseEnabled>true</adSenseEnabled>
              <borderColor>FFFFFF</borderColor>
              <titleColor>0000FF</titleColor>
              <backgroundColor>FFFFFF</backgroundColor>
              <textColor>000000</textColor>
              <urlColor>008000</urlColor>
              <adType>TEXT_AND_IMAGE</adType>
              <borderStyle>DEFAULT</borderStyle>
              <fontFamily>DEFAULT</fontFamily>
              <fontSize>DEFAULT</fontSize>
            </value>
          </inheritedAdSenseSettings>
        </results>
      </rval>
    </getAdUnitsByStatementResponse>
  </soap:Body>
</soap:Envelope>