User Tag List

Results 1 to 10 of 10

Thread: Call webservice

  1. #1
    No Products Registered

    Join Date
    Feb 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Call webservice

    Hi,

    I am creating a game which needs to call a webservice. The webservice is REST+HTTP based and returns either JSON or XML (based on the Accept header).

    Security is either Basic Authorization (using the Authorization HTTP header) or two-legged OAuth.

    How can I call such a webservice from my game?

    Putting it simple I just need to download a file (a .xml file) from a webserver using HTTP while being able to modify the HTTP headers.

  2. #2
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2006
    Location
    In a Dark room with only a lamp
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    Using the get object you should be able to achieve the result you want.

    You can pass a url to the get object and display the results in rich edit box or edit box. whichever you prefer,

    You could also use the download object but i find that the get object works a bit better.

    Unfortunately i had to develop another solution for use in my Application as my companies proxy server blocked access using both these objects. the result was the use of a vbscript which was compiled on the fly.

    it's quite easy to do especially if you only have a few variables. if you want me to knock an example together i'll need all the info you want to pass to the server.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    Get object won't do any auth/header modification.

  4. #4
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2006
    Location
    In a Dark room with only a lamp
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    in that case the vbscript option is probably the better

  5. #5
    No Products Registered

    Join Date
    Feb 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    It would be great if you could paste your vbscript lembi2001, and write a short description on how to use it

  6. #6
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2006
    Location
    In a Dark room with only a lamp
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    I can do that no problem but I have a few different ones. Each one performs a different operation dependant on what the desired result is. That is the reason I was asking for the variables you pass to the server.

    I have 3 scripts.

    One downloads an image from a website, the other two download a full web page and save them as html. I may be able to modify one of the page downloaders but i need to know what the response looks like and also the request.

    I am not being awkward honestly, i just want to make sure that i give you the correct script.

  7. #7
    No Products Registered

    Join Date
    Feb 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    It won't be a problem for me to write the VBScript myself, it would however be very helpful if you could give me a hint on how to use this script inside MMF

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    You have to tell him what you want the pass to the server.

  9. #9
    No Products Registered

    Join Date
    Feb 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    I can create the VBScript myself, so it isn't important how the communication with the server is handled.

    I would however really appreciate it, if someone could explain how to call a VBScript from a MMF game.

    Thanks in advance,
    Uldall

  10. #10
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Oct 2006
    Location
    In a Dark room with only a lamp
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Call webservice

    Sorry for the delayed response. Completely forgot about this thread.

    If you haven't soved it already, this is how i did it.

    Copy wscript.exe (usually C:\windows\system32) to your apps folder (this is so that it can always be found)

    Have a template vbscript in there too. For the variables in the script replace them with something you can identify.

    For example in the Library Application i used these scripts in my book cover downloader had the variable <<ISBN>> in the web address.

    At the start of the frame i loaded my template vbscript into a rich edit box. when the search button was clicked the following was done:

    A search was done to find <<ISBN>> in the script template. this was then selected. I replaced the selection with the actual ISBN number i was searching for i then saved this as a vbscript of a different filename.

    using the event File <<scriptname>>.vbs exists and Only one action.... i then triggered the execution of the vbsctipt using the following syntax:

    Execute External Program
    Program Name - Appdir$+"wscript.exe"
    Command Line - " <<scriptname>>.vbs"
    Application behaviour - "wait"

    You need to select wait if your app requires the results of your vbscript to function correctly.

    Once you have the results you can delete <<scriptname.vbs>> as part of your app

    If this is unclear let me know and i will mock something up for you.

Similar Threads

  1. Make a Call without "Call Phone" permission?!?
    By StingRay in forum Android Export Module Version 2.0
    Replies: 4
    Last Post: 21st April 2013, 08:35 AM
  2. Call function?
    By Skyhunter in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 7th November 2010, 01:01 AM
  3. Load on call
    By Kalnar in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 18th January 2008, 01:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •