Error changing content type with Web Services

danevil's Avatar


13 Aug, 2015 07:42 PM

Please help, for some reason I'm getting an error when using web services to change a page's content type.

I edited a group of pages using PHP web services. The operation seemed to be successful, however when I then viewed the pages in the CMS, it gave this error:

An error occurred: java.lang.NullPointerException

The web service operation I ran was pretty simple, the goal was to change the content type, using this code:

// read in page asset to $page, then...
$page->contentTypePath = 'new-content-type';
unset ($page->contentTypeId);
unset ($page->configurationSetId);
// then save using $reply = $client->edit ($params);
// $reply->editReturn->success is 'true' ...

Running Cascade v7.12.2

  1. 1 Posted by Ryan Griffith on 14 Aug, 2015 12:02 PM

    Ryan Griffith's Avatar


    A couple of suggestions to try:

    • Try also unsetting configurationSetPath to see if maybe there's some weird reference going on:
      unset ($page->configurationSetPath);
    • Try using contentTypeId instead, perhaps there's an issue with trying to assign the Content Type by name, which could explain the NPE

    Please let me know if you have any questions.


  2. 2 Posted by danevil on 17 Aug, 2015 04:07 PM

    danevil's Avatar

    Hi Ryan,

    Thanks for the suggestions, I tried them but unfortunately I'm still getting the same error.

    Using web services, I compared the asset object model of one of these broken assets with a working asset with the same content-type. They really seem identical except for different ID, title, etc, so I'm not sure what is causing the error..

    I think I will try another route, use web services to read the old assets and then create a fresh new page, copying the data.

  3. 3 Posted by Wing Ming Chan on 17 Aug, 2015 04:53 PM

    Wing Ming Chan's Avatar


    If you haven't taken a look at my library yet, maybe you should. Specifically, look at the Page class.


  4. 4 Posted by Ryan Griffith on 25 Aug, 2015 08:03 PM

    Ryan Griffith's Avatar


    I was going over some older discussions and noticed this one is still open. Were you able to work through your issue with changing Content Types using Web Services? Did you have a chance to scope out Wing's Web Services library?

    Please feel free to let us know if you have any other questions.


  5. 5 Posted by danevil on 25 Aug, 2015 08:33 PM

    danevil's Avatar

    Hi Ryan,

    Thanks for following up. I never was able to change Content Types using web services, but I took a different approach (created new pages and then copy data to new pages using web services), which solved my problem in the end.

    I had already done that by the time Wing had replied, otherwise I’m sure his library would have worked too.

    - Daniel

  6. 6 Posted by Ryan Griffith on 26 Aug, 2015 03:05 PM

    Ryan Griffith's Avatar

    Thank you for following up, Daniel, I am glad to hear you were able to come up with a solution.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  7. Ryan Griffith closed this discussion on 26 Aug, 2015 03:05 PM.

  8. Wing Ming Chan re-opened this discussion on 08 Sep, 2015 04:24 PM

  9. 7 Posted by Wing Ming Chan on 08 Sep, 2015 04:24 PM

    Wing Ming Chan's Avatar

    Normally I don't write raw code (code without using my own library) to deal with assets. But on this occasion I am working on a new page in my tutorial site and I did write a simple program with raw code to switch the content type associated with a page as a demo. See Lesson 2 for details. Part of the purpose of this page, which is not yet finished, is to show how clumsy it is to write raw code to do something seemingly simple.


  10. Tim closed this discussion on 22 Sep, 2015 04:19 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac


26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM