[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-soap
Subject:    [SOAP] PHP SOAP - classmap - choice in complex type
From:       sem user <sem_user () yahoo ! com>
Date:       2007-08-20 20:03:39
Message-ID: 450679.13492.qm () web44813 ! mail ! sp1 ! yahoo ! com
[Download RAW message or body]


Hi All,

I am a new bee to the PHP SOAP and have following problem. Any help is greatly \
appreciated. 

The WSDL file I am using has following complex type

<xs:element name="elemgreeting">
        <xs:complexType>
            <xs:choice>
                <xs:element name="greeting1" type="xs:string"/>
                <xs:element name="greeting2" type="xs:string"/>
                <xs:element name="greeting3" type="xs:string"/>
            </xs:choice>
        </xs:complexType>
</xs:element>

I am using PHP with SOAP extensions to handle server side operations. Using classmap \
feature I have created classmap for above complex type as 

class GreetingDataTypeMap
{
    public $greeting1;
    public $greeting2;
    public $greeting3;
}

This class is mapped properly to the elemtn and passed to the SOAP server. 

Function sayHello (its present in WSDL and added properly to SOAP server) returns \
greeting as 

function sayHello (NameDataType $n)
{
    $g = new GreetingDataTypeMap;
    $g->greeting2 = "greeting2";
    return $g;
} 

If this function sets any other greeting other than $greeting1 (i.e.greeting2 or \
greeting3) then that greeting is not being returned properly and SOAP message shows \
up as follows 

   <SOAP-ENV:Body>
      <ns1:elemgreeting>
         <greeting1/>
      </ns1:elemgreeting>
   </SOAP-ENV:Body> 

Ideally above function should return 
 
<SOAP-ENV:Body>
      <ns1:elemgreeting>
         <greeting2>greeting2</greeting2>
      </ns1:elemgreeting>
   </SOAP-ENV:Body> 
Can someone please point out what I am doing wrong in above classmap? 

Thanks in advance for your help

thanks,
rahul

       
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic