Results 1 to 3 of 3

Thread: ERP Connection with NuSoap

  1. #1
    JAYA is offline Junior Member
    Join Date
    Dec 2010
    Posts
    4

    Red face ERP Connection with NuSoap

    Hi,
    I am trying to make ERP connection so that i can get all the data from ERP to sugarcrm 6.1.0. i have published my method on webservices and i do not know how to consume that webservices on my sugarcrm, as i am new to webservices and sugarcrm, so many genious out there, can anyone tell me the code or any help.
    Thanks & Regards.
    Last edited by JAYA; 2010-12-07 at 10:15 AM.

  2. #2
    mtvtaras's Avatar
    mtvtaras is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    82

    Default Re: ERP Connection with NuSoap

    Hi JaYa!

    You can use clear PHP functions or SOAP class in the sugar.
    PHP code here
    PHP Code:
    <?php

    $client 
    = new SoapClient(NULL,
            array(
            
    "location" => "http://64.124.140.30:9090/soap",
            
    "uri"      => "urn:xmethods-delayed-quotes",
            
    "style"    => SOAP_RPC,
            
    "use"      => SOAP_ENCODED
               
    ));

    print(
    $client->__call(
            
    /* SOAP Method Name */
            
    "getQuote",
            
    /* Parameters */
            
    array(
                new 
    SoapParam(
                    
    /* Parameter Value */
                    
    "ibm",
                    
    /* Parameter Name */
                    
    "symbol"
            
    )),
            
    /* Options */
            
    array(
                
    /* SOAP Method Namespace */
                
    "uri" => "urn:xmethods-delayed-quotes",
                
    /* SOAPAction HTTP Header for SOAP Method */
                
    "soapaction" => "urn:xmethods-delayed-quotes#getQuote"
            
    )). "\n");
    ?>
    Sugar SOAP code you can find into examples folder.

  3. #3
    JAYA is offline Junior Member
    Join Date
    Dec 2010
    Posts
    4

    Red face Re: ERP Connection with NuSoap

    Hello,

    Thanks for your reply. I have successfully published a method called hello as a webservice through nuSOAP.Following is the code for helloworld.php:

    <?php
    if(!defined('sugarEntry'))define('sugarEntry', true);
    require_once('include/entryPoint.php');
    require_once('include/utils/file_utils.php');
    ob_start();
    //ignore notices
    error_reporting(E_ALL ^ E_NOTICE);
    global $HTTP_RAW_POST_DATA;
    require_once('soap/SoapError.php');
    // Pull in the NuSOAP code
    require_once('include\nusoap\nusoap.php');
    $NAMESPACE = 'http://www.sugarcrm.com/sugarcrm';
    // Create the server instance
    $server = new nusoap_server;

    $server->configureWSDL('hello', $NAMESPACE, $sugar_config['site_url'].'/soap.php');

    // Register the method to expose
    $server->register('hello');
    // Define the method as a PHP function
    function hello($name) {
    return 'Hello, ' . $name;
    }


    require_once('soap/SoapSugarUsers.php');
    //require_once('soap/SoapSugarUsers_version2.php');
    require_once('soap/SoapData.php');
    require_once('soap/SoapDeprecated.php');

    /* Begin the HTTP listener service and exit. */
    ob_clean();

    if (!isset($HTTP_RAW_POST_DATA)){
    $HTTP_RAW_POST_DATA = file_get_contents('php://input');
    }



    // Use the request to (try to) invoke the service
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    global $soap_server_object;
    $soap_server_object = $server;
    $server->service($HTTP_RAW_POST_DATA);
    ob_end_flush();
    flush();
    sugar_cleanup();
    exit();
    ?>

    Now i wantto consume this webservice through a php code using NUSOAP.
    Following is the code for client.php:


    <?php

    if(!defined('sugarEntry'))define('sugarEntry', true);

    require_once('include/entryPoint.php');
    require_once('include/utils/file_utils.php');

    //ignore notices
    error_reporting(E_ALL ^ E_NOTICE);


    // Pull in the NuSOAP code
    require_once('include/nusoap/nusoap.php');


    // Create the client instance
    $client = new nusoapclient('http://localhost/suncrm/helloworld.php');
    // Call the SOAP method
    $result = $client->call('hello',array('name'=>'scott'));

    // Display the result
    print_r($result);

    ?>

    The code is running but i am unable to get the value of $result.i will be thankful to you for this.your help would be greatly appreciated.
    Thanks & Regards.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ../include/nusoap/nusoap.php help [sugarsoap]
    By ericV in forum Developer Help
    Replies: 2
    Last Post: 2010-05-10, 03:02 PM
  2. nusoap - PHP
    By kketterman in forum Developer Help
    Replies: 4
    Last Post: 2010-03-04, 12:07 PM
  3. Soap/ Nusoap and php 5.2.9
    By spiderglobe in forum Developer Tutorials
    Replies: 4
    Last Post: 2010-01-18, 02:04 PM
  4. Help with nusoap
    By jflaker in forum Developer Help
    Replies: 1
    Last Post: 2008-10-13, 12:02 AM
  5. nusoap vs. soap: which to use and why?
    By hanmari in forum General Discussion
    Replies: 6
    Last Post: 2008-05-12, 05:20 PM

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
  •