cancel
Showing results for 
Search instead for 
Did you mean: 

first timer connecting to sap

Former Member
0 Kudos

hi need help.

it is my first time to connect my application from php/perl to sap.

the sap developer gave me WSDL but no matter how many try i do i dont get the response or the XML from the system.

tried this in PHP

[code]

class SapTest {

  const SAP_WSDL_URI  = "203.177.50.135:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&receiverParty=&receiverService=&interface=SI_DF_AssetMaster&int";

  const SAP_USER = "user";

  const SAP_PWD  = "pass";

public function execute() {

        $header =new SoapHeader('urn:sap-com:document:sap:soap:functions:mc-style', null);

        $client->__setSoapHeaders($header);

        $client = new SoapClient('http://'.urlencode(self::SAP_USER).':'.urldecode(self::SAP_PWD).'@'.self::SAP_WSDL_URI,

                array("trace" => 1,

                      "exceptions" => 1,

                      "login" => self::SAP_USER,

                      "password" => self::SAP_PWD,

                      'features' => SOAP_SINGLE_ELEMENT_ARRAYS)

        );

        $method = '_-bic_-nf2';

        $parameter = array('ETColumnDescription' => null,

                          'ETGridData' => null,

                          'ETMessageLog' => null,

                          'ETRowDescription' => null,

                          'ISVar_01xwerbet' => array('Sign' => 'I',

                                                      'Option' => 'LE',

                                                      'Low' => '3',

                                                      'High' => null));

        try

        {

        $result = $client->$method($parameter);

        print_r($result);

        } catch(SoapFault $e) {

        echo "REQUEST HEADER:\n" . $client->__getLastRequestHeaders() . "\n";

          echo "REQUEST:\n" . $client->__getLastRequest() . "\n";

          echo "RESPONSE HEADER:\n" . $client->__getLastResponseHeaders() . "\n";

          echo "RESPONSE:\n" . $client->__getLastResponse() . "\n";

        print_r($e);

    }

}

}

$oSap = new SapTest();

$oSap->execute();

[/code]

even tried this via soap

[code]

$SOAP_AUTH = array( 'username' => 'user',

                        'password' => 'pass');

   #Specify WSDL

    $WSDL = "https://203.177.50.135:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet...";

  

    try{

        $client = new SoapClient($WSDL, array('username'=>"user",'password'=> "pass"));

    }

    catch(SoapFault $fault) {

        trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);

    }

    #Create Client Object, download and parse WSDL

    $client = new SoapClient($WSDL,$SOAP_AUTH);

  

    #Setup input parameters (SAP Likes to Capitalise the parameter names)

  

    $params = array(

            'LASTDATEUPDATE_FROM' => "20150101",

            'LASTDATEUPDATE_TP' => "20151101"

    );

    #Call Operation (Function). Catch and display any errors

    try

    {

       $result = $client->ZSoapDemo1($params);

    }

    catch (SoapFault $exception)

    {

        print "***Caught Exception***\n";

        print_r($exception);

        print "***END Exception***\n";

        die();

    }

  

    #Out the results

    print_r($result);

[/code]

hope someone here tried something like this.

the purpose is that i have a web application that needs to get details from SAP and at the same time SUBMIT POST data from data entry on the web application i am doing which is using PHP.

thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

justin_santhanam
Active Contributor
0 Kudos

Hello Oliver,

I didn't ask you to remove int, I said there was some missing parameters.. But I have taken a look at your https port, that seems to have the below parameters which I was asking you about.

&interface=SI_DF_Company&interfaceNamespace=urn:ariba.com:xi:OnDemand:Vendor

Just a dumb question, you both are on the same internal network and trying to access using SOAP UI?\\

Thanks

Former Member
0 Kudos

yes basically i am on mobile network so he tried to connect to my phone just to test.

so from his computer there is a response but from my computer no response.

not sure what else installed on his laptop all he just ask is install the soapUI application on my computer and provide the WSDL and user/pass.

anyway my main concern is actually not the SoapUI it is just used to test if it will going to work.

the primary concern is to make PHP or PERL work since the PHP/PERL will be executed from a different server and connection to SAP via WSDL on their XI.

maybe someone here has a sample PHP/PERL code that i could follow.

thanks.

justin_santhanam
Active Contributor
0 Kudos

Hello Oliver,

The URL you have doesn't seems like having the interface namespace &int"; You are missing that parameter there.

If you have given the dummy URL in the thread here, then

did you check with the SAP Developer to see if your calls reaching at least PI?

Thnx

Former Member
0 Kudos

the url is working using his application which is soapUI.

but again the soapUI only works on this computer tried to install it on my computer it doesnt give me response too.

the developer don't know what to do too that why i came across this board maybe someone already implement this kind of process.

by the way you saying about "int" tried to remove it it still gives me error.

here's the error i get.


Fatal error: SOAP Fault: (faultcode: WSDL, faultstring: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://203.177.50.135:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&...' : failed to load external entity "http://203.177.50.135:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&..." ) in /srv/www/dfmsys/unilab/soaptest.php on line 19

and yeah there is another URL

https://xidev1:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&receive...

and this is the response i get.


Fatal error: SOAP Fault: (faultcode: WSDL, faultstring: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://xidev1:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&receive...' : failed to load external entity "https://xidev1:50001/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_DiamondFleet&receive..." ) in /srv/www/dfmsys/unilab/soaptest.php on line 19

thanks.