Hellos alls , this blog is about Web Services (WS) and trying to use them in PHP , it’s kind of cool , but it gave me a lot of headakes for 2 weeks to understand , i used HTML5 Builder (That’s right is in HTML5 just to proof that i can ,jejej)

So Lets….

what we are going to do is a simple conection to a WS and then show data in a grid , this is the UI for the page

/wp-content/uploads/2013/10/ui_289935.png

As you can see is a button , a label and a grid just to show some data

Now to see the code

The declaration

<?php
require_once("rpcl/rpcl.inc.php");
require("rpcl/nusoap/nusoap.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("platinumgrid/jtplatinumgridlite.inc.php");
use_unit("jqgrid/jqgrid.inc.php");
use_unit("comctrls.inc.php");
use_unit("styles.inc.php");

This is how i star the code , but to be honest , it’s auto generated by my php suite ,jejeje , the only thing that i write in this part was line number 3 , (trust me we are going to need it)

Now i’ll show you the real code , when i click in the  button is gonna call the WS to sap and ask me about my credentials

 function Button1Click($sender, $params)
    {
  // mi codigo THOR 15/05/2013
    // crea el cliente
    $wsdl = true;
    $cliente = new nusoap_client('wsdltabla.wsdl', $wsdl );
    $cliente->soap_defencoding = 'UTF-8';
    $cliente->setCredentials('adm1','Mjo2','basic')  ;

Firs we have to start a cliente , this is what is going to connect to sap , line 11 are declaration where we say to the WS that we are using wsdl file or direccion , in this case a file , becase by a url didn’t work

line 12  the decoding uds for this , more declaration for the client

line 13 is where we put the credentials to be sent to sap , in this order is user , password , and mode of autentication

NEXT time i’ll explain the other steps for this button , thanks

To report this post you need to login first.

11 Comments

You must be Logged on to comment or reply to a post.

  1. Andy Silvey

    Hi Alan,

    excellent blog and thank you for sharing.

    This will be very useful to anybody interested in getting SAP and PHP to work

    together.

    Best regards,

    Andy.

    (0) 
      1. Andy Silvey

        thanks

        I am working on a little personal project at the moment, using the apache, php, mysql standard and this is useful for me for the SAP/PHP part.

        Thanks,

        Andy.

        (0) 
          1. Andy Silvey

            a flavour of linux, I don’t know which I will have to ask the hoster.

            currently the project is in the functional design stage

            I know what the product will do, and am doing the functional

            and database design

            i have the domain, but not the hosting yet, and no code written yet

            Andy.

            (0) 
            1. Alan Indomenico Post author

              We had 2 servers , the first one was windows XP , apache , and oracle (really messy) but it was to start understandig how to work with php and apache , now we have cent os (like red hat) , are you planing doing it web oriented or destokp ? , i recomend to work in web design , so any device can see it no matter how

              (0) 

Leave a Reply