Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid request payload error #2

Open
kadnan opened this issue Jan 20, 2014 · 10 comments
Open

Invalid request payload error #2

kadnan opened this issue Jan 20, 2014 · 10 comments

Comments

@kadnan
Copy link

kadnan commented Jan 20, 2014

On adding banner I get Invalid request error. Code is given below:

 $bannerInfo = array(    'bannerId' => (int)$bannerId,
                                       'campaignId' => (int)$campaignId,
                                       'bannerName' => $bannerName,
                                      // 'storageType' => 'string',
                                       'imageURL' => $imageURL,
                                       'htmlTemplate' => '',
                                       'width'  => 0,
                                       'height' => 0,
                                       'weight' => 0,
                                       'target' => '_blank',
                                       'url' => $url,
                                       'bannerText' => $bannerText,
                                       'status' => (int)$status,
                                      // 'adserver' => 'string',
                                       'transparent' => 0,
                                      // 'capping' => 'integer',
                                      // 'sessionCapping' => 'integer',
                                      // 'block' => 'integer',
                                       'aImage' => $aImage,
                                     //  'aBackupImage' => 'custom',
                                       'comments' => $comments,
                                       'alt' => $alt,
                                       'filename' => $filearray['name'],
                                      // 'append' => 'string',
                                      // 'prepend' => 'string',
                                       );

It throws following exception:

Invalid request payload: xmlrpc element NIL cannot be child of VALUE

@mbeccati
Copy link
Contributor

That's what I do in a project that uses this api client:

use fXmlRpc\Client,
    fXmlRpc\ExtensionSupportInterface,
    fXmlRpc\Serializer\XmlWriterSerializer;

use OpenXApiClient\OpenXApiClient;

...

        $serializer = new XmlWriterSerializer;
        $serializer->disableExtension(ExtensionSupportInterface::EXTENSION_NIL);
        $client = new Client($url, null, null, $serializer);
        return new OpenXApiClient($client, $user, $pass);

@mbeccati
Copy link
Contributor

When I have some time, I'll speak to @Rohea about fixing some remaining bugs and moving the project to the Revive Adserver repo.

@kadnan
Copy link
Author

kadnan commented Jan 20, 2014

I am not getting how is it related with my issue? any workaround of my problem? is it issue at OpenX RPC end?
Is there anyway I can print XML payload?

@mbeccati
Copy link
Contributor

The OpenX/Revive API doesn't support NIL elements. That's why I disable them in the serializer of the client.

@kadnan
Copy link
Author

kadnan commented Jan 20, 2014

But what Element is actually goin Nil? I did paste the array structure I am sending. What am I missing?

@mbeccati
Copy link
Contributor

There are quite a few things commented out, so all of them maybe? ;)

@kadnan
Copy link
Author

kadnan commented Jan 20, 2014

Right, one of my dev friend was working on it, I will take care of it and test myself with payload. How do I know what fields re necessary to send and what not?

@mbeccati
Copy link
Contributor

There's currently no APi doc available, so you can either do trial & error or look up the Revive source code. But then agin, you'd currently need something like the above in order to avoid having to send the optional fields.

@TomiS
Copy link
Member

TomiS commented Jan 21, 2014

@mbeccati You can grab this under the Revive project namespace whenever you want. Probably you want to rename from OpenX to Revive at the same time too? We also have a reference to this in Packagist.org so just let me know when you wish to do the change and I'll do what I can to make sure people find the official version.

@HasanJuniad
Copy link

My problem was solved by following
NEW
'storageType' =>'html',
//'url' => $url,
//'comments' => $comments,
//'alt' => $alt
OLD
'storageType' =>'img',
'url' => $url,
'comments' => $comments,
'alt' => $alt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants