Hello Gustav,
First of all I really recommend to consider upgrading to a newer version of rails and using the library. It handles quite a lot of tricky issues you face with SOAP. As per the issue, you need to generate something like this instead: <ins0:keyword xsi:type='Keyword'> <ins1:type>KEYWORD</ins1:type> ... this is done in Savon with ":attributes!" hash entry. Looking forward, you will also need to provide an ":order!" entry to make sure the parameters are in the correct order. -Danial, AdWords API Team. On Thursday, December 13, 2012 5:15:01 PM UTC-8, Gustav Gennrich wrote: > > Hi, > > I recently was forced to transition away from the ruby client library > because the most current version uses rack 1.4 which is incompatible with > rails 2.3.11 (depends on rack ~> 1.1). I cannot use any of the prior gem > versions because the API's have already sunset. As a result, we are writing > our own SOAP requests using Savon. I am having a lot of trouble getting the > correct format set up. Below is my Savon code followed by the XML that is > generated: > > SAVON CODE > client = Savon::Client.new(" > https://adwords.google.com/api/adwords/o/v201209/TrafficEstimatorService?wsdl > ") > @response = client.request :get do |soap| > soap.element_form_default = false > soap.header = { > "ins0:RequestHeader" => { > "ins1:clientCustomerId" => @client_customer_id, > "ins1:userAgent" => @user_agent, > "ins1:developerToken" => @developer_token, > "ins1:authToken" => @auth_token > } > } > soap.body = { > "ins0:selector" => { > "ins0:campaignEstimateRequests" => [{ > "ins0:adGroupEstimateRequests" => [{ > "ins0:keywordEstimateRequests" => [ > {"ins0:keyword" => {"ins1:text" => "online schools", > "ins1:matchType" => "EXACT"} > } > ], > "ins0:maxCpc" => {"ins1:microAmount" => "99000000"} > }], > "ins0:criteria" => [ > {"ins1:id" => "2840", "xsi:type" => "ins1:Location"}, > {"ins1:id" => "1000", "xsi:type" => "ins1:Language"} > ] > }] > } > } > end > > XML CODE: > <?xml version="1.0" encoding="UTF-8"?> > <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:tns="https://adwords.google.com/api/adwords/o/v201209 > " > xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:ins0="https://adwords.google.com/api/adwords/o/v201209 > " > xmlns:ins1=" > https://adwords.google.com/api/adwords/cm/v201209"> > <env:Header> > <ins0:RequestHeader> > <ins1:clientCustomerId>809-888-9384</ins1:clientCustomerId> > <ins1:userAgent>rails_app</ins1:userAgent> > <ins1:developerToken>H6DYNBuj0p3WafYpA3dq9g</ins1:developerToken> > > <ins1:authToken>DQAAAMgAAADKUU2gnMfJ7oU0F30VsFhgVtJNoVhB2Rb7YJiqEna6D3WLArF5-Vvjxqdy4gkUZP4Ire0Qrg-_DyTKNuGhV_U7Z4SIpsuzVXsjlAMVD07VAFv7pfw9qFi1E9FphXPgHeoIhJ_atLD9b-sbD77fBmwCCgf882zNx329BbpOVstNqZ__UGh4IHJsnsWXpwEqyAT2yzlXCo38osbdNZ9TSS9HCQeQPVg7e1hTIR7u4Dl0F6bIF0NcgEYi4CETeJZzllS7ECfP5lOwWVu1W9Z35WnV</ins1:authToken> > </ins0:RequestHeader> > </env:Header> > <env:Body> > <ins0:get> > <ins0:selector> > <ins0:campaignEstimateRequests> > <ins0:adGroupEstimateRequests> > <ins0:keywordEstimateRequests> > <ins0:keyword> > <ins1:type>KEYWORD</ins1:type> > <xsi:type>Keyword</xsi:type> > <ins1:text>online schools</ins1:text> > <ins1:matchType>EXACT</ins1:matchType> > </ins0:keyword> > </ins0:keywordEstimateRequests> > <ins0:maxCpc> > <ins1:microAmount>99000000</ins1:microAmount> > </ins0:maxCpc> > </ins0:adGroupEstimateRequests> > <ins0:criteria> > <ins1:id>2840</ins1:id> > <xsi:type>Location</xsi:type> > </ins0:criteria> > <ins0:criteria> > <ins1:id>1000</ins1:id> > <xsi:type>Location</xsi:type> > </ins0:criteria> > </ins0:campaignEstimateRequests> > </ins0:selector> > </ins0:get> > </env:Body> > </env:Envelope> > > The error I keep getting is as follows: > Savon::SOAP::Fault: (soap:Client) Unmarshalling Error: > cvc-complex-type.2.4.a: Invalid content was found starting with element > 'xsi:type'. One of > '{"https://adwords.google.com/api/adwords/cm/v201209":type, > "https://adwords.google.com/api/adwords/cm/v201209":Criterion.Type}' is > expected. > > According to the documentation I need to specify "xsi:type" as > Criterion.Type and type are ignored if passed along > > Any ideas on what I am doing wrong? > > Thanks, > > Gustav > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en