Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina fornisce informazioni sulle intestazioni delle richieste XML SOAP richieste e sulle intestazioni restituite in risposta.
Intestazioni delle richieste obbligatorie
Tutte le chiamate SOAP dell'API devono avere un elemento <RequestHeader> nell'intestazione; questo elemento è definito in tutti i WSDL del servizio. Le librerie client forniscono metodi per aggiungere automaticamente questa intestazione utilizzando i valori che fornisci. Ecco una descrizione di tutti gli elementi di <RequestHeader>:
Elemento
Descrizione
<networkCode>
Il codice di rete della rete a cui viene indirizzato il messaggio. I codici di rete sono obbligatori per tutte le richieste, ad eccezione di NetworkService.getAllNetworks() e NetworkService.makeTestNetwork().
Assicurati di utilizzare esclusivamente un codice di rete disponibile per l'accesso all'account. Puoi trovare il codice sul sito web di Google Ad Manager per il tuo account, nella pagina Amministrazione > Impostazioni di rete accanto a "Codice di rete".
<applicationName>
Un nome stringa arbitrario che identifica l'applicazione. Verrà visualizzato nei file di log di Google. Ad esempio: "Il mio inventario
Applicazione" o "App_1".
Nota: ogni richiesta che la tua applicazione invia all'API Ad Manager deve includere un token di accesso OAuth2. Passa il token nell'intestazione HTTP come: Authorization: Bearer YOUR_ACCESS_TOKEN.
Richiesta di esempio
Di seguito è riportato un esempio di chiamata di richiesta SOAP a getAdUnitsByStatement() che cerca il AdUnit principale.
Nota: se la richiesta SOAP determina un Unmarshalling error, consulta la sezione Errori comuni per suggerimenti sulla risoluzione dei problemi.
Intestazioni della risposta
Tutte le risposte restituite dall'API includono i seguenti elementi di intestazione. Come
una best practice, ti consigliamo di registrare questi valori.
Elemento
Descrizione
<requestId>
Identifica in modo univoco questa richiesta. Se hai problemi di assistenza, inviaci questo ID per consentirci di trovare più facilmente la tua richiesta.
<responseTime>
Tempo trascorso tra la ricezione della richiesta da parte del servizio web e l'invio della richiesta
la risposta corretta.
Esempio di risposta
Il seguente codice mostra un esempio di risposta SOAP per la richiesta precedente.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-08-21 UTC."],[[["\u003cp\u003eThis page outlines the required and returned SOAP XML headers when interacting with the Google Ad Manager API.\u003c/p\u003e\n"],["\u003cp\u003eAll API requests require a \u003ccode\u003eRequestHeader\u003c/code\u003e with \u003ccode\u003enetworkCode\u003c/code\u003e and \u003ccode\u003eapplicationName\u003c/code\u003e, along with an OAuth2 access token in the HTTP header.\u003c/p\u003e\n"],["\u003cp\u003eResponses from the API include a \u003ccode\u003eResponseHeader\u003c/code\u003e containing \u003ccode\u003erequestId\u003c/code\u003e and \u003ccode\u003eresponseTime\u003c/code\u003e for tracking and support purposes.\u003c/p\u003e\n"],["\u003cp\u003eThe API utilizes a document/literal wrapped style for SOAP communication.\u003c/p\u003e\n"]]],["SOAP API calls require a `\u003cRequestHeader\u003e` with a `\u003cnetworkCode\u003e` (except for specific network service requests) and an `\u003capplicationName\u003e`. Each request also needs an OAuth2 access token in the HTTP header. Example SOAP requests are given. Responses include `\u003crequestId\u003e` and `\u003cresponseTime\u003e` headers, which should be logged for troubleshooting. The API uses document/literal wrapped style SOAP. Example response code is given showing the header structure.\n"],null,["# SOAP XML Request and Response Headers\n\nThis page provides information on the required SOAP XML request headers, and the headers that are returned in response.\n| **Note:** The API uses document/literal wrapped style SOAP, not RPC/encoded style.\n\nRequired Request Headers\n------------------------\n\nAll API SOAP calls must have a `\u003cRequestHeader\u003e` element in the header; this element is defined in all the service WSDLs. The [client libraries](/ad-manager/api/clients) provide\nmethods to add this header for you, using the values that you supply. Here is a description of all the elements of `\u003cRequestHeader\u003e`:\n\n| Element | Description |\n|:--------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `\u003cnetworkCode\u003e` | The network code of the network being addressed. Network codes are required when making all requests except `NetworkService.getAllNetworks()` and `NetworkService.makeTestNetwork()`. Be sure that you only use a network code available to your account login. You can find the code on the Google Ad Manager website for your account, on the Admin \\\u003e Network Settings page next to \"Network code\". |\n| `\u003capplicationName\u003e` | An arbitrary string name identifying your application. This will be shown in Google's log files. For example: \"My Inventory Application\" or \"App_1\". |\n\n**Note:** Every request your application sends to the Ad Manager API must include an OAuth2 access token. Pass the token in the HTTP header as: `Authorization: Bearer YOUR_ACCESS_TOKEN`.\n\n**Example Request**\n\nThe following code is an example of a SOAP request call to `getAdUnitsByStatement()` looking for the root `AdUnit`. \n\n```world-of-warcraft-toc\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003csoapenv:Envelope\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\u003e\n \u003csoapenv:Header\u003e\n \u003cns1:RequestHeader\n soapenv:actor=\"http://schemas.xmlsoap.org/soap/actor/next\"\n soapenv:mustUnderstand=\"0\"\n xmlns:ns1=\"https://www.google.com/apis/ads/publisher/v202508\"\u003e\n \u003cns1:networkCode\u003e123456\u003c/ns1:networkCode\u003e\n \u003cns1:applicationName\u003eDfpApi-Java-2.1.0-dfp_test\u003c/ns1:applicationName\u003e\n \u003c/ns1:RequestHeader\u003e\n \u003c/soapenv:Header\u003e\n \u003csoapenv:Body\u003e\n \u003cgetAdUnitsByStatement xmlns=\"https://www.google.com/apis/ads/publisher/v202508\"\u003e\n \u003cfilterStatement\u003e\n \u003cquery\u003eWHERE parentId IS NULL LIMIT 500\u003c/query\u003e\n \u003c/filterStatement\u003e\n \u003c/getAdUnitsByStatement\u003e\n \u003c/soapenv:Body\u003e\n\u003c/soapenv:Envelope\u003e\n```\n\n**Note:** If your SOAP request causes an `Unmarshalling error`, see [Common Errors](/ad-manager/api/troubleshooting#Unmarshalling) for troubleshooting tips.\n\nResponse Headers\n----------------\n\nAll responses returned from the API include the following header elements. As\na best practice, we recommend that you log these values.\n\n| Element | Description |\n|:---------------------|:--------------------------------------------------------------------------------------------------------------------------------------|\n| **\u003crequestId**`\u003e` | Uniquely identifies this request. If you have any support issues, sending us this ID will enable us to find your request more easily. |\n| **`\u003cresponseTime\u003e`** | Elapsed time between the web service receiving the request and sending the response. |\n\n**Example Response**\n\nThe following code shows an example of a SOAP response for the previous request. \n\n```actionscript-3\n\u003csoap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\n \u003csoap:Header\u003e\n \u003cResponseHeader xmlns=\"https://www.google.com/apis/ads/publisher/v202508\"\u003e\n \u003crequestId\u003exxxxxxxxxxxxxxxxxxxx\u003c/requestId\u003e\n \u003cresponseTime\u003e1063\u003c/responseTime\u003e\n \u003c/ResponseHeader\u003e\n \u003c/soap:Header\u003e\n \u003csoap:Body\u003e\n \u003cgetAdUnitsByStatementResponse xmlns=\"https://www.google.com/apis/ads/publisher/v202508\"\u003e\n \u003crval\u003e\n \u003ctotalResultSetSize\u003e1\u003c/totalResultSetSize\u003e\n \u003cstartIndex\u003e0\u003c/startIndex\u003e\n \u003cresults\u003e\n \u003cid\u003e2372\u003c/id\u003e\n \u003cname\u003eRootAdUnit\u003c/name\u003e\n \u003cdescription\u003e\u003c/description\u003e\n \u003ctargetWindow\u003eTOP\u003c/targetWindow\u003e\n \u003cstatus\u003eACTIVE\u003c/status\u003e\n \u003cadUnitCode\u003e1002372\u003c/adUnitCode\u003e\n \u003cinheritedAdSenseSettings\u003e\n \u003cvalue\u003e\n \u003cadSenseEnabled\u003etrue\u003c/adSenseEnabled\u003e\n \u003cborderColor\u003eFFFFFF\u003c/borderColor\u003e\n \u003ctitleColor\u003e0000FF\u003c/titleColor\u003e\n \u003cbackgroundColor\u003eFFFFFF\u003c/backgroundColor\u003e\n \u003ctextColor\u003e000000\u003c/textColor\u003e\n \u003curlColor\u003e008000\u003c/urlColor\u003e\n \u003cadType\u003eTEXT_AND_IMAGE\u003c/adType\u003e\n \u003cborderStyle\u003eDEFAULT\u003c/borderStyle\u003e\n \u003cfontFamily\u003eDEFAULT\u003c/fontFamily\u003e\n \u003cfontSize\u003eDEFAULT\u003c/fontSize\u003e\n \u003c/value\u003e\n \u003c/inheritedAdSenseSettings\u003e\n \u003c/results\u003e\n \u003c/rval\u003e\n \u003c/getAdUnitsByStatementResponse\u003e\n \u003c/soap:Body\u003e\n\u003c/soap:Envelope\u003e\n```"]]