
sreenu
New User
Nov 8, 2006, 1:39 AM
Post #1 of 1
(603 views)
|
Hi, I am writing a application using SOAP. I am using SOAP package. I am getting an error code as a response. Can u you help me. Here is my Code. print "Hello, World...\n"; use SOAP; #use SOAP::Lite +trace => 'debug'; my $token = "1f4a71c7c30234affa49bb8a97502f61"; &ModifyCampaign(); sub ModifyCampaign() { my $referenceNumber = "123"; my $name = "test"; my $description = "this is for testing! Updation succeeded"; my $account = "482067"; my $maxCPC = "0.09"; my $budget = "1000"; my $campaign_id = "485813"; #my $token = '1f4a71c7c30234affa49bb8a97502f61'; my $campaignValues = { 'reference_number' => $referenceNumber, 'name' => $name, 'description' => $description, 'account_id' => $account, 'campaign_state' => "On", 'max_cpc' => $maxCPC, 'budget' => $budget, 'campaign_id' => $campaign_id}; # Obtain a reference to the service. my $service = SOAP::Lite->service('https://api-sandbox.sponsoredlistings.ask.com/api/v2/campaigns/service.wsdl'); # Modify the data for the specified campaign. my $output = $service->UpdateCampaign($token, SOAP::Data->name(campaign => $campaignValues)->type('CampaignStructs..Campaign')); # Display the results on screen. print "Modified an existing campaign with the following information:\n"; print "\nName: ", $output->{'name'}; print "\nDescription: ", $output->{'description'}; print "\nAccount ID: ", $output->{'account_id'}; print "\nCampaign ID: ", $output->{'campaign_id'}; print "\nReference Number: ", $output->{'reference_number'}; print "\nCampaign State: ", $output->{'campaign_state'}; print "\nMaximum CPC: ", $output->{'max_cpc'}; print "\nBudget: ", $output->{'budget'}; } While running this code I am getting this error : This is the response I am getting: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:typens="http://api-sandbox.sponsoredlistings.ask.com/api/v2" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><typens:UpdateCampaign><token xsi:type="xsd:string">1f4a71c7c30234affa49bb8a97502f61</token><campaign xsi:nil="true" xsi:type="typens:CampaignStructs..Campaign" /></typens:UpdateCampaign></soap:Body></soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Cache-Control: private Connection: close Date: Wed, 08 Nov 2006 08:02:00 GMT Server: Mongrel 0.3.13.3 Content-Length: 1264 Content-Length: 1264 Content-Type: text/xml; charset=UTF-8 Client-Date: Wed, 08 Nov 2006 07:02:04 GMT Client-Peer: 64.241.242.109:443 Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/ST=Arizona/L=Scottsdale/O=Starfield Technologies, Inc./OU=http://www.starfieldtech.com/repository/CN=Starfield Secure Certification Authority/emailAddress=practices@starfieldtech.com Client-SSL-Cert-Subject: /O=api-sandbox.sponsoredlistings.ask.com/OU=Domain Control Validated/CN=api-sandbox.sponsoredlistings.ask.com Client-SSL-Cipher: AES256-SHA Client-SSL-Warning: Peer certificate not verified Content-Disposition: inline Content-Transfer-Encoding: binary Status: 200 OK <?xml version="1.0" encoding="UTF-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <env:Fault xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <faultcode xsi:type="xsd:QName">env:Server</faultcode> <faultstring xsi:type="xsd:string">undefined method `[]' for nil:NilClass</faultstring> <faultactor xsi:type="xsd:string">ActionWebService::Protocol::Soap::SoapProtocol</faultactor> <detail xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom" xsi:type="n2:SOAPException"> <cause xmlns:n3="http://www.ruby-lang.org/xmlns/ruby/type/1.6" xsi:type="n3:ActionWebService..ActionWebServiceError"> <message xsi:type="xsd:string">undefined method `[]' for nil:NilClass</message> <backtrace xsi:type="n1:Array" n1:arrayType="xsd:anyType[0]"> </backtrace> </cause> <excn_type_name xsi:type="xsd:string">ActionWebService..ActionWebServiceError</excn_type_name> </detail> </env:Fault> </env:Body> </env:Envelope>
|