Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using NuSoap

Posted on 2010-08-29
2
Medium Priority
?
481 Views
Last Modified: 2013-12-13
Hi all ,
To develop SOAP web service , i use nusoap. i read the code and some example. It is clear for me.
But our partner request authentication by using header in SOAP message. I find the function in nusoap library for this but it doesn't have.Would anybody help me to find the solution for authencation by header ?
how to do it if we use nusoap library. Tks so much

0
Comment
Question by:dinhchung82
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 33557996
I am going to ask you to consider going in a different direction.  Do not use SOAP at all.  Instead choose a RESTful design pattern.

In REST, your authentication will be made with an API key that will be transmitted on every request.  If you put your REST service behind SSL, the API key is pretty safe and secure.

The reason for choosing REST over SOAP is very simple.  REST is easy to use.  SOAP introduces the idea of a "contract" between the services, where each side must do complex actions in certain orders.  This is a sure recipe for confusion as the HUGE number of questions about "Why can't I get SOAP to work?" clearly shows.  In contrast, I never see anyone posting a question at EE about how to get REST to work!

Some examples of successful REST interfaces include the Yahoo and Google Geocoders, and even the client-server nature of the WWW itself.
http://en.wikipedia.org/wiki/Representational_State_Transfer

Here is a little code snippet that will show you a simple REST application.  It takes a first name and returns the last name.  REST applications can return any data string - XML, JSON, and CSV strings are common.

Best of luck with it, ~Ray
<?php // RAY_REST_get_last_name.php
error_reporting(E_ALL);



// DEMONSTRATE HOW A RESTFUL WEB SERVICE WORKS
// CALLING EXAMPLE:
// file_get_contents('http://laprbass.com/RAY_REST_get_last_name.php?key=ABC&name=Ray');



// OUR DATA MODEL CONTAINS ALL THE ANSWERS - THIS COULD BE A DATA BASE QUERY - AS COMPLEX AS NEEDED
$dataModel
= array
( 'Brian'   => 'Portlock'
, 'Ray'     => 'Paseur'
, 'Richard' => 'Quadling'
)
;


// TEST THE API KEY - THE ASSUMPTION IS FAILURE
$key = FALSE;

// IF THE URL CONTAINS THE KEY
if (isset($_GET["key"])) $key = $_GET["key"];

// IF THE KEY FAILS TO MATCH OUR OUR REQUIRED 'ABC'
if ($key !== 'ABC') die('BOGUS API KEY');



// LOOK UP THE LAST NAME - THE ASSUMPTION IS FAILURE
$name="?";

// IF THE URL CONTAINS THE FIRST NAME
if (isset($_GET["name"])) $name = $_GET["name"];

// IF THE URL NAME IS FOUND IN THE DATA MODEL
if (array_key_exists($name, $dataModel))
{
    // RETURNS THE LAST NAME FROM THE DATA MODEL
    die("$dataModel[$name]");
}

// RETURNS THE UNKNOWN NAME INDICATOR
else die('UNKNOWN');

Open in new window

0
 
LVL 5

Author Closing Comment

by:dinhchung82
ID: 33578271
Thanks genius , i try to study about Rest ;)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question