MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

URGENT: PostTo from my .net aspx page?

Last post 05-13-2009 5:37 PM by rondata. 65 replies.
Page 4 of 5 (66 items) < Previous 1 2 3 4 5 Next >
Sort Posts: Previous Next
  • 09-30-2008 12:53 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    Hi Rhonda,

    I actually spent a bunch of time looking at the forum.  Trouble is, I am lacking the background you have and wrongly assume every one looking at this also has.

    I read the thread with Chad's message.  In fact I even referred to it in my first post.  The problem is that it says you can use the iframe mechanism with requestSendMessage and it does not work for me. 

    And the reason it does not work is the same as what was explained by lala on that same thread namely that this.endpoint_ is null unless you host name matches some tokens.  See code below:

    int MyOpenSpace021.Core.v07.js 

    Tokenized: function(endPoint, userInfo, version, format, operationMode, osToken, osMode) {

    654 var server;
    655 var serverMySpace;
    657 // if AUTO mode, select actual mode depending on hostname
    658 if (operationMode == MyOpenSpace.OperationModes.AUTO) {
    659 if (location.hostname.match(/^localhost/)) {
    660 operationMode = MyOpenSpace.OperationModes.LOCALHOST;
    661 } else if (location.hostname.match(/^local-/)) {
    662 operationMode = MyOpenSpace.OperationModes.LOCAL;
    663 } else if (location.hostname.match(/^dev-/)) {
    664 operationMode = MyOpenSpace.OperationModes.DEVELOPMENT;
    665 } else if (location.hostname.match(/^stage-/)) {
    666 operationMode = MyOpenSpace.OperationModes.STAGE;
    667 } else if (location.hostname.match(/^api./)) {
    668 operationMode = MyOpenSpace.OperationModes.PRODUCTION;
    669 } else {
    670 return null;

    operationMode is AUTO.  The api does nto let you change this.

    Is this expected?  

    Also, the link you sent earlier (http://developer.myspace.com/Community/forums/p/3192/16879.aspx#16879) leads to a blank page at the moment.


     

  • 10-01-2008 5:28 AM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    I sent all this info to the folks who created the code samples, you're going to have to hang tight. 

     

  • 10-06-2008 9:12 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    Any updates on this?
  • 10-07-2008 6:53 AM In reply to

    Re: URGENT: PostTo from my .net aspx page?

     Yes they did find some things in the code that needed to be modified, last I remember. I'll check in today. Thanks for the reminder :)

  • 10-08-2008 7:48 AM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    Hello any update on the above?  It seems a ton of us developers are having this issue.  Looking forward to hearing from you,

     

    Kind regards,

    Joshua

  • 10-08-2008 7:53 AM In reply to

    • frick
    • Not Ranked
    • Joined on 09-09-2008
    • Posts 7

    Re: URGENT: PostTo from my .net aspx page?

     Hi, Ronda -- thnx for taking the time to be the intermediary and having to put up with all of us anxious developers.

    After looking at Justin's comment from 09/30/08 I was able to add in another location.hostname and match my domain allowing me to actually embed the friend-picker widget just with no friends as there are so many other modifications that need to be done to the libraries for them to work properly cross-frame.

     In your last post you had mentioned that there were some changes that were needed --do you have more information on this yet? You're going to be quite the cross-frame js wizard here soon. ;)

  • 10-08-2008 2:32 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    I am waiting to hear back. Soon as I do you will too :)

    Sorry for the delay, we're getting ready to go with new stuff and I've been a little occupied. ;)

     

    Rhonda

     

  • 10-08-2008 6:00 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

     

    A new zip file with the fix for the null exception has been uploaded. Just a reminder this work around is to be able to use functionality not available on REST like


    requestSendMessage
    requestShareApp
    requestNavigateTo
    adjustHeight

    Not for data requests like FetchPeople, FetchPerson etc. For that you need to use Rest directly.

    Jorge Reyes

  • 10-09-2008 7:38 AM In reply to

    • frick
    • Not Ranked
    • Joined on 09-09-2008
    • Posts 7

    Re: URGENT: PostTo from my .net aspx page?

     Hi,

      Where's the link to the new zip?

    http://stephaniepb.googlepages.com/myspace_opensocial_javascript_200809.zip still contain the old files. Speaking of which -- why are these not being hosted on your domain?

    Also, in anticipation of further forum posts would an updated page such as http://developer.myspace.com/community/myspace/da6.aspx with a working example of say requestshareapp be easy to implement?

     Thanks.

     

  • 10-09-2008 11:43 AM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    frick, 

    The contents are different even though the zip file name is the same.  I have tried it and verified that the error I complained about is gone.  Thanks MDP folks!

    Can someone at MDP confirm we are downloading the right thing. 

    j

  • 10-09-2008 11:53 AM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    Jorge,

    Using what I think is the latest code... 

    I have not tried other but requestSendMessage still cannot be called from an iframe.
    The reason is it first calls FetchPerson, and the calls postTo with the result.  FetchPerson does an ajax call which gets a cross-domain permission error.

    Am I missing something?

    Thanks 

     

    Code for reference: 

    3164 MyOpenSpace.MySpaceContainer.prototype.requestSendMessage = function(recipients, message, opt_callback){

    3165 var type = message.getField(opensocial.Message.Field.TYPE);

    3166 if(type === opensocial.Message.Type.NOTIFICATION || type === opensocial.Message.Type.PRIVATE_MESSAGE || type === opensocial.Message.Type.PUBLIC_MESSAGE){
    3167 if(recipients === opensocial.DataRequest.PersonId.OWNER || recipients === opensocial.DataRequest.PersonId.VIEWER){
    3168 var request = opensocial.newDataRequest();
     
    3169 request.add(request.newFetchPersonRequest(recipients));      <<== HERE
     
    3170 request.message = message;
    3171 request.opt_callback = opt_callback;
    3172 request.send(opensocial.Container.get().requestSendMessageWrapper);
    3174 else if(!isNaN(parseInt(recipients, 10)) && recipients.constructor !== Array){
    3175 var request = opensocial.newDataRequest();
     
    3176 request.add(request.newFetchPeopleRequest(recipients));       <<== HERE
     
    3177 request.message = message;
    3178 request.opt_callback = opt_callback;
    3179 request.send(opensocial.Container.get().requestSendMessageWrapper);

  • 10-10-2008 3:02 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

     Hi,

     You are correct requestSendMessage and requestShareApp require and ID or array of IDs. Internally these calls call FetchPersonRequest to get the person object and then send them to PostTo. Instead of using requestShareApp and requestSendMessage you can use directly postTo.

    var message = opensocial.newMessage(content);

    message.setField(opensocial.Message.Field.TITLE, subject);
    message.setField(opensocial.Message.Field.TYPE, postType);


    opensocial.Container.get().postTo(openSocialToken, message, person, callback_function);

    where
    openSocialToken: Valid open Social Token.
    messange: opensocial.Message object,
    person: recipient person object
    callback_function: optional callback function.

     There is just a small change on MyOpenSpace021.v07.js

    on line 3260

    _IFPC.call(
                        this.params_.panelId,
                        "postTo",
                        [MyOpenSpace.MySpaceContainer.OSToken, messageType, messageSubject, messageBody, personId, personImage, personName, personProfile],
                        this.params_.remoteRelay,
                        opt_callback,
                        this.params_.localRelay,
                        null);

     

    MyOpenSpace.MySpaceContainer.OSToken needs to change to os_token

                 _IFPC.call(
                        this.params_.panelId,
                        "postTo",
                        [os_token, messageType, messageSubject, messageBody, personId, personImage, personName, personProfile],
                        this.params_.remoteRelay,
                        opt_callback,
                        this.params_.localRelay,
                        null);

     

     

  • 10-10-2008 10:20 PM In reply to

    Re: URGENT: PostTo from my .net aspx page?

    I changed line 3260 as mentioned above and finally here is the working code


     

    <script src="http://www.mydomain.com/OpenSocial/references/gadgets003.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/references/opensocialreference001.v07.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace007.Util.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace005.Entities.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace010.Mappers.v07.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace003.Enums.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace021.Core.v07.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/MyOpenSpace010.Engine.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/references/ifpc002.js" type="text/javascript"></script>
    <script src="http://www.mydomain.com/OpenSocial/references/json001.js" type="text/javascript"></script>

    <script type="text/javascript">
    //<![CDATA[   
        opensocial.Container.get().registerParam("ptoString", "COMMENTS,BLOG,BULLETINS,PROFILE,SEND_MESSAGE,SHARE_APP");
        opensocial.Container.get().registerParam("panelId", "apppanel_<?=$_GET[appid]?>_canvas");
        opensocial.Container.get().registerParam("localRelay", "http://www.mydomain.com/OpenSocial/ifpc_relay_external001.html");
        opensocial.Container.get().registerParam("remoteRelay", "http://profile.myspace.com/Modules/Applications/Pages/ifpc_relay.aspx");
        opensocial.Container.get().registerParam("ownerid", "<?=$_GET[opensocial_owner_id]?>");
        opensocial.Container.get().registerParam("appid", "<?=$_GET[appid]?>");
    //]]>
    </script>

    <a href="#" onClick="send()">Send Invite To Tom</a>

    <script>

    function send(){
        l_message = opensocial.newMessage( "[sender] would like you to install this really super application [app]." );
        l_message.setField(opensocial.Message.Field.TITLE, 'Welcome');
        l_message.setField(opensocial.Message.Field.TYPE, MyOpenSpace.PostTo.Targets.SHARE_APP);
        var usr =  new User();
        opensocial.Container.get().postTo('<?=$_GET[opensocial_token]?>', l_message, usr, callback);   
    }

    function callback(){
        document.write('callback called');
    }

    function User() {
        this.id = 6221;
        this.display_name = 'Tom';
        this.thumbnail_url = 'http://b2.ac-images.myspacecdn.com/00000/20/52/2502_s.jpg';
        this.profile_url = 'http://myspace.com/6221';
    }

    User.prototype.getId = function(){
        return this.id;
    }

    User.prototype.getDisplayName = function() {
        return this.display_name;
    }

    User.prototype.getField = function(key){
        switch(key){
            case opensocial.Person.Field.THUMBNAIL_URL: return this.thumbnail_url;
            case opensocial.Person.Field.PROFILE_URL: return this.profile_url;
        }
        return undefined;
    }

    </script>

  • 10-14-2008 7:27 PM In reply to

    • D
    • Not Ranked
    • Joined on 09-19-2008
    • Posts 7

    Re: URGENT: PostTo from my .net aspx page?

    Why is the javascript library not hosted on the main page?  here:  http://developer.myspace.com/community/libs/libraryintro.aspx

     

    Why is it http://stephaniepb.googlepages.com/myspace_opensocial_javascript_200809.zip?

  • 10-14-2008 7:50 PM In reply to

    • D
    • Not Ranked
    • Joined on 09-19-2008
    • Posts 7

    Re: URGENT: PostTo from my .net aspx page?

     " There is just a small change on MyOpenSpace021.v07.js"

    First off, this file does not exist.  Do you mean MyOpenSpace021.Core.v07.js?

     

    Second -  please confirm we are downloading the right ZIP.  This is bullshit, edging towards insanity.

     

    "Not for data requests like FetchPeople, FetchPerson etc. For that you need to use Rest directly."

    Third, when you say things like this, CAN YOU PLEASE POINT US IN THE RIGHT DIRECTION(i.e. offer a link to documentation & source code examples)?   I'll go count the number of people with unanswered questions about using some sort of API in an external iFrame, if you'd like.

Page 4 of 5 (66 items) < Previous 1 2 3 4 5 Next >