简体   繁体   中英

Can I redirect/alias one web service call to another?

I've written a simple PHP nusoap web service for an application and wish to change the name of one of the actions so that it makes more sense. However there is a CD-ROM based application in the wild using this web service and this action and so I need to redirect or alias any incoming requests to the new action... any idea how I might go about doing this?

I'm assuming by action you mean a function, why not something as simple as.

function oldName($a, $b)
{
    return newName($a, $b);
}

function newName($a, $b)
{
    // do something
    return $a + $b;
}

Seems like a quick and easy solution.

If your HTTP server features URL rewriting you can use this solution to translate the old action to the new one without the need to touch the code.

In Apache, for instance, it's a matter enabling mod_rewrite and setting up the rewrite rules either in the host configuration or in an .htaccess file within your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM