Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
elalan
Participant

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

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

11 Comments