+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12
This is a discussion on How to setup outbound message and receive the data in Mysql. within the Salesforce PHP Tutorials forums, part of the Salesforce category; I want to setup an outbound message , to collect workflow data
  1. #1
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7

    Thumbs up How to setup outbound message and receive the data in Mysql.

    I want to setup an outbound message , to collect workflow data in my mysql data base.

    I am new in it , can u please explain me step by step process to setup SOAP on web server to collect workflow data and store it into the mysql.

  2. #2
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7
    Can anyone provide me detail code.

  3. #3
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    are you trying to create a replication to MySQL or just get certain data into MySQL?

  4. #4
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7
    No... Like in workflow we can send email when certain condition achieve, same instead of email I want to call outbound message and send sms or do other stuffs.

    I want workflow data in Mysql , It is all about outbound message.

  5. #5
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    setting up a listener is something that is quite easy and I have examples on this page, but I can help you get the data that you need.

    So to get a basic listener setup here is the code that you need:

    PHP Code:
    //set this so your wsdl is not cached
    ini_set("soap.wsdl_cache_enabled", "0");

    //set this to receive the message from Salesforce
    $data = fopen('php://input', 'rb');

    //this gets the data and puts it into XML
    $content = stream_get_contents($data);

    //mail yourself the message to see what it looks like
    mail('you@gmail.com', 'Salesforce outbound data', $content);

    //checks to see if you have received a good message from Salesforce
    //and then sends a true or false back to Salesforce to clear out the 
    //outbound message from the que
    if ($content)
    {
        respond('true');
    }
    else
    {
        respond('false');
    }


    //function to respond to salesforce using the soap formatted message below
    function respond($tf)
    {

        print '<?xml version "1.0" encoding "utf-8"?>
       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
           <soapenv:Body>
               <notifications xmlns="http://soap.sforce.com/2005/09/outbound">
                   <Ack>' . $tf . '</Ack>
                  </notifications>
              </soapenv:Body>
          </soapenv:Envelope>';
    }
    This is a basic setup. You will still need to consume the XML/SOAP message and format it so you.

    I use a program that I purchased called Magic Parser > Magic Parser | PHP XML, RSS & CSV Parser


    When you get the email with the outbound message, you can take it and go to the magic parser site and paste in the XML and it will generate the code for you. then you place that into your script and you can format it anyway you want to insert it into MySQL.


    Hope that helps!!!

    ~Mike

  6. #6
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7
    I have create a file and copy ur code into this.
    I called it from salesforce outbound message but SF showing "org.xml.sax.SAXException: Bad envelope tag: br" error.

  7. #7
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7
    Thx Mike....
    The script is working. I have getting the raw data on mail.
    Please let me know the next step to extract data.

  8. #8
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    You need to parse the XML data and put it into an array and then store that data into the database!! That is why I said you should look at magic parser! That will parse the XML message

  9. #9
    nitin is offline Junior Member
    Join Date
    Mar 2011
    Posts
    7
    Magic parser cost me apprx $75, I taken the project only in $100. So it is not possible for me to buy the file. Is there any alternative.

  10. #10
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    You could see if any of the code in this thread works > Using Salesforce Outbound SOAP Messages with PHP

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Salesforce/PHP - Bulk Outbound message (SOAP), Time out issue
    By ppafford in forum Salesforce Coding Discussions
    Replies: 8
    Last Post: 03-23-2010, 08:28 AM
  2. xampp new install - toolkit setup issue
    By nrwingate in forum Salesforce Coding Discussions
    Replies: 4
    Last Post: 10-21-2009, 05:24 PM
  3. Outbound Messages + Merge Records
    By ambiguator in forum Salesforce PHP Tutorials
    Replies: 10
    Last Post: 09-29-2009, 01:24 PM
  4. how to receive user data from salesforce to php
    By lucasvm in forum Salesforce Coding Discussions
    Replies: 1
    Last Post: 01-15-2009, 08:27 PM
  5. Replies: 9
    Last Post: 08-22-2007, 08:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

SEO by vBSEO 3.5.2