views:

24

answers:

1

Hi,

I have created simple soap server using php, The WSDL used is at : http://fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl

Response i m getting has a miss matched namespace for the Login response tag:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://roomplanner.icovia.com/pci"&gt;
  <SOAP-ENV:Body>
    <ns1:LoginResponse xsi:type="http://roomplanner.icovia.com/pci"&gt;   <<<==== This shoud be <LoginResponse xmlns="http://roomplanner.icovia.com/pci"&gt;
      <LoginResult>
        <register>
          <customer>Rajat Teotia</customer>
        </register>
      </LoginResult>
    </ns1:LoginResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Code for the simple soap server is :

<?php

class Login {
 public function Login($username, $password) {
  $ns = 'http://roomplanner.icovia.com/pci';
  $LoginResponse = new StdClass();
  $LoginResponse->LoginResult->register->customer = 'Rajat Teotia';
  return new SoapVar ( $LoginResponse, SOAP_ENC_OBJECT, $ns);
 }
}
$fydWsdl = "http://www.fromyourdesign.com/webapp/wsdl/fromyourdesign.wsdl";
ini_set ( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache
$server = new SoapServer ( $fydWsdl );
$server->setClass ( "Login" );
$server->handle ();
?> 

What can be done to fix this issue. Thanx in advance.

Rajat

A: 

Hello Rajat.

Seems, you have a wrong list of parameters in your code. Namespace should be the fourth parameter, not the third.

SoapVar::SoapVar ( string $data , string $encoding [, string $type_name [, string $type_namespace [, string $node_name [, string $node_namespace ]]]] )

Greetings Julian

Julian