Solved

Using NuSoap

Posted on 2010-08-29
2
470 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 110

Accepted Solution

by:
Ray Paseur earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
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…

752 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