locked
Difficulty in using V5 API RRS feed

  • Question

  • Hi,

    I'm trying to call the GetCampaignsByAccountId() API, but getting authentication error. I'm sure that the credentials are valid, because they work properly with V4 API. Here is my XML:

    *** Outgoing HTTP headers **********************************************
    POST /api/advertiser/v5/CampaignManagement/CampaignManagementService.svc?wsdl HTTP/1.0
    Host: adcenterapi.microsoft.com
    User-agent: SOAPpy 0.11.4 (http://pywebsvcs.sf.net)
    Content-type: text/xml; charset="UTF-8"
    Content-length: 944
    SOAPAction: "GetCampaignsByAccountId"
    ************************************************************************
    *** Outgoing SOAP ******************************************************
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlnsTongue TiedOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlnsTongue TiedOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header>
    <DeveloperToken xmlns="https://adcenter.microsoft.com/api/advertiser/v5" SOAP-ENC:root="1">
    <Value>XXXXXXXXXX</Value>
    </DeveloperToken>
    <UserCredentials xmlns="https://adcenter.microsoft.com/api/advertiser/v5" SOAP-ENC:root="1">
    <Username>XXXXXXXXXX</Username>
    <Password>XXXXXXXXXX</Password>
    </UserCredentials>
    <ApplicationToken xmlns="https://adcenter.microsoft.com/api/advertiser/v5" SOAP-ENC:root="1">
    <Value></Value>
    </ApplicationToken>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <GetCampaignsByAccountIdRequest xmlns="https://adcenter.microsoft.com/api/advertiser/v5" SOAP-ENC:root="1">
    <accountId>XXXXX</accountId>
    </GetCampaignsByAccountIdRequest>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    ************************************************************************
    *** Incoming HTTP headers **********************************************
    HTTP/1.? 500 Internal Server Error
    Connection: close
    Date: Sat, 05 Apr 2008 08:03:36 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
    X-AspNet-Version: 2.0.50727
    Cache-Control: private
    Content-Type: text/xml; charset=utf-8
    Content-Length: 701
    ************************************************************************
    *** Incoming SOAP ******************************************************
    <s:Envelope xmlnsTongue Tied="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information</faultstring><detail><ApiFaultDetail xmlns="https://adcenter.microsoft.com/api/advertiser/v5" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><BatchErrors/><OperationErrors><OperationError><Code>112</Code><Details i:nil="true"/><Message>Authentication failed. Either the username, password or developer token is invalid.</Message></OperationError></OperationErrors><TrackingId>777af6cd-7660-4448-a0d4-d8dcf5eb9a70</TrackingId></ApiFaultDetail></detail></s:Fault></s:Body></s:Envelope>
    ************************************************************************

    Could anyone please help me to figure out problem here?


    Another question, in case of customer aggregator, exactly where should one pass the AccountId in the header section? Any XML example would be greatly appreciated.


    Thanks.
    Saturday, April 5, 2008 8:17 AM

All replies

  • We are experiencing what seems to be the same problem. Did you find a solution?
    Thursday, April 10, 2008 10:32 PM
  • The only thing that I can notice is that in your soap header you are not setting the accountID property. From the MSN documentation it states:

    "In addition to the ApiUserAuthHeader changes, each SOAP header request (ApiRequestHeader) will contain an AccountId property. This property is not used by most customers. However, it is being implemented to support customer aggregators. If you are not a customer aggregator, set this property to null. If you are a customer aggregator, set this property to the customer's account ID"

    Here is what my soap looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlnsTongue Tiedoapenv="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:ApplicationToken soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns1="https://adcenter.microsoft.com/api/advertiser/v5"/>
            <ns2Big SmileeveloperToken soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns2="https://adcenter.microsoft.com/api/advertiser/v5">
                <ns2:Value>XXXXXXXXX</ns2:Value>
            </ns2Big SmileeveloperToken>
            <ns3:UserCredentials soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns3="https://adcenter.microsoft.com/api/advertiser/v5">
                <ns3Stick out tongueassword>XXXXXXX</ns3Stick out tongueassword>
                <ns3:Username>XXXXXXX</ns3:Username>
            </ns3:UserCredentials>
            <ns4:AccountId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns4="https://adcenter.microsoft.com/api/advertiser/v5"/>
        </soapenv:Header>
        <soapenv:Body>
            <GetCampaignsByAccountIdRequest xmlns="https://adcenter.microsoft.com/api/advertiser/v5">
                <AccountId>XXXXXXXX</AccountId>
            </GetCampaignsByAccountIdRequest>
        </soapenv:Body>
    </soapenv:Envelope>

    Friday, April 11, 2008 4:05 PM
  • Thanks for the follow-up. It turns out our first problem was the developer token in our acceptance email had a zero ('0') in it but it really was the letter 'O'. I triple-checked that character, but I never thought the switch could have happened on their end Stick out tongue
    Friday, April 11, 2008 10:47 PM