nanek / example-dfp-line-item-generator

Example code to help you quickly and systematically create line items in Google's Doubleclick for Publishers
MIT License
37 stars 17 forks source link

CreateOrder not able to send externalOrderId #17

Closed tacshooter closed 8 years ago

tacshooter commented 8 years ago

My createOrders call works flawlessly whenever I pass my object without the externalOrderId, like:

var args = { orders: [{
    name: 'My Order Name',
    advertiserId: 86999999,
    traffickerId: dfpTraffickerID
}]};

However, I get a soap error when I pass the externalOrderId, like:

var args = { orders: [{
    name: 'My Order Name',
    advertiserId: 86999999,
    traffickerId: dfpTraffickerID,
    externalOrderId: '#100043'
}]};

The error is below and I sure would appreciate any help you could give. I've tried using v201505, v201511 and v201602.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Client</faultcode>
      <faultstring>Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'externalOrderId'. One of '{"https://www.google.com/apis/ads/publisher/v201602":secondaryTraffickerIds, "https://www.google.com/apis/ads/publisher/v201602":salespersonId, "https://www.google.com/apis/ads/publisher/v201602":secondarySalespersonIds, "https://www.google.com/apis/ads/publisher/v201602":totalImpressionsDelivered, "https://www.google.com/apis/ads/publisher/v201602":totalClicksDelivered, "https://www.google.com/apis/ads/publisher/v201602":totalViewableImpressionsDelivered, "https://www.google.com/apis/ads/publisher/v201602":totalBudget, "https://www.google.com/apis/ads/publisher/v201602":appliedLabels, "https://www.google.com/apis/ads/publisher/v201602":effectiveAppliedLabels, "https://www.google.com/apis/ads/publisher/v201602":lastModifiedByApp, "https://www.google.com/apis/ads/publisher/v201602":isProgrammatic, "https://www.google.com/apis/ads/publisher/v201602":programmaticSettings, "https://www.google.com/apis/ads/publisher/v201602":appliedTeamIds, "https://www.google.com/apis/ads/publisher/v201602":lastModifiedDateTime, "https://www.google.com/apis/ads/publisher/v201602":customFieldValues}' is expected. </faultstring>    
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Also, what would be the best way to log the soap requests as they're sent? I'd like to get a look at them going out to figure out what's going wrong...

Thanks a ton man, Ferg

JuanCaicedo commented 8 years ago

Same error here as with #18. Try ordering your properties to match the order in the api reference. This is an error coming from something in the WSDL library I think. Since property order is not significant in JS (and a pain to get right) I think the long term fix for this would be not have a mechanism (in either node-google-dfp or node-google-dfp-wrapper) that the input object to another object with the properties in the correct order.

tacshooter commented 8 years ago

Same as #18 - thanks again!