Hello,

I need help on how to integrate the passing of information in XML format from ASP.Net(from client) to PHP(my server). I've been searching for solution but cannot find accurate results. A sample code is very much appreciated.

Thank you.

Recommended Answers

All 7 Replies

Thanks LastMitch.

What I mean is the transfer of the information in XML format. How can it be done from ASP.Net to PHP. I know how to create and read an XML file but I want to know how to pass this from ASP.Net(from client) to PHP(my server). Can it be done by Php SOAP(my first time to use SOAP) or any suggestions? I am using Php in receiving and sending of XML data. ASP.Net is used by my client.

SOAP is possible, so is REST. If you can provide a little example of how the flow is supposed to be between the two, you may get a more accurate answer.

The scenario is, user will register on the client website(developed in ASP.Net) then once registered, it will pass the full name and member number to another website developed in PHP.

Depending on what you need to return, a REST service is a good option. Basically you post that information to a PHP script, which then decides what to return.

Hi,

I tried nusoap and here's the sample code of client(test_client.php) that will call the service.

    require_once('lib/nusoap.php');
    $param = array('format'=>'json', 'country'=>'24');
    $client = new soapclient ('http://localhost/nusoap/service.php?wsdl');
    $response = $client->call('getCityName', "691003"); 

The web service code(service.php) is as follows,

function getCityName ($pincode){ 
    global $db;
    if ($pincode == '') {       
        return new soap_fault(
            'Client', '',
            'Must supply a pincode',''
        );
    } 
    $cityNames = array('691003' => 'Kollam', '691235' => 'Ernakulam', '6945678' => 'Trivandrum');
    return $cityNames['$pincode'];
} 

Then it shows the error,

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/nusoap/service.php?wsdl' : Start tag expected, '<' not found in C:\xampp\htdocs\nusoap\test_client.php:4 Stack trace: #0 C:\xampp\htdocs\nusoap\test_client.php(4): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in C:\xampp\htdocs\nusoap\test_client.php on line 4

return $cityNames['$pincode'];

Remove the single quotes:

return $cityNames[$pincode];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.