Re: Another .Net issue

From: Date: Thu, 24 Apr 2003 16:51:08 +0000
Subject: Re: Another .Net issue
References: 1 2  Groups: php.soap 
Request: Send a blank email to php-soap+get-571@lists.php.net to get a copy of this message
Thanks Dmitri, That was it. This seems overly complex though, is there any way to make PEAR::SOAP return objects based on the data in $__dispatch_map, or is that exercise left up to the user to create? Rob "Dmitri" <dimitri@vinogradov.de> wrote in message news:20030424002921.94873.qmail@pb1.pair.com... > Hi, Rob > > it seems like You have not defined the return type of your soap-method ... > > Normaly, PEAR::SOAP returns structure like this: > > <return xsi:type="ns4:RETURN_TYPE"> > <CUSTOM_TYPE xsi:type="SOAP-ENC:Array" > SOAP-ENC:arrayType="nsX:OTHER_CUSTOM_TYPE[2]" SOAP-ENC:offset="[0]"> > <item xsi:type="nsX:OTHER_CUSTOM_TYPE"> .... </item> > <item xsi:type="nsX:OTHER_CUSTOM_TYPE"> .... </item> > </ARRAYTYPE> > </return> > > to understand the type definition for Disco.php please look at example > 'disco_server.php': > method 'GetMP3Tracks()' returns custom type "GetMP3TracksResult" contains > two father custom types: > "MethodDebug" and "MP3Tracks", where "MP3Tracks" is an array of > farther > custom type called > "MP3TracksArray" and so on and so on ... Every of this custom types must be > defined... > > > So if you want your method returns an array of your custom types (in this > case it would be type called "Struct"), define at first > the custom type "Struct": > > $this->__typedef['Struct'] = > array( > 'varString' => 'string', > 'varInt' => 'integer', > 'varFloat' => 'float' > ); > > > > than type "ArrayOfStruct" > > > > $this->__typedef['ArrayOfStruct'] = > array( > array( > 'item' => '{urn:YOURNAMESPACE}Struct' > ) > ); > > and than the return type of your method - something like > "MEHTODNAME_Result": > > > $this->__typedef['MEHTODNAME_Result'] = > array( > 'Structs' => '{urn:YOURNAMESPACE}ArrayOfStruct' > ); > > > so now you can implement method, some kind of this: > > .... > function MEHTODNAME () { > for($i = 0; $i < 5; $i++) { > $this->Structs[$i] = new SOAP_Value( > 'item', > '{urn:YOURNAMESPACE}Struct', > array( > "varString" => new > SOAP_Value("varString","string","me varString, yo"), > "varInt" => new > SOAP_Value("varInt","int",(integer)1000000), > "varFloat" => new > SOAP_Value("varFloat","float",1.5) > ) > ); > } > return new SOAP_Value( > 'return', > '{urn:YOURNAMESPACE}MEHTODNAME_Result', > array( > "ArrayOfStruct" => new SOAP_Value('ArrayOfStruct', > '{urn:YOURNAMESPACE}ArrayOfStruct', $this->Structs) > ) > ); > } > > > Hope it helps.... > > > P.S. Thanks for recognizing bug in soap:binding transport - hope Shane > will fix it asap :) > > > "Rob Booth" <rbooth@indyme.com> schrieb im Newsbeitrag > news:20030423215511.97137.qmail@pb1.pair.com... > > I know, why .Net? Well it wasn't my decision to make. Anyway the problem > > that I'm running into is this: > > > > I have PEAR::SOAP running as my server and I'm trying to communicate with > C# > > as my client. I've made some changes to allow C# to automatically > generate > > it's proxy code and can connect to my server and interact as long as I'm > > only dealing with simple data types and basic structures of simple data > > types. However when I try to return an array I get this error: > > > > The specified type was not recognized: name='Struct', > > namespace='', at > > <return xmlns=''>. > > > > I've looked at what gets returned by my server and this is the structure: > > > > <result xsi:type="SOAP-ENC:Array" > > SOAP-ENC:arrayType="Struct[4]" > > SOAP-ENC:offset="[0]"> > > > > In trying to solve this I looked at what the Google search service > returns, > > since it returns arrays and I found Google uses a structure like this: > > > > <resultElements xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/" > > xsi:type="ns3:Array" ns3:arrayType="ns1:ResultElement[10]"> > > > > Why are these two structrues for handleing SOAP arrays different, and what > > can I do to make PEAR::SOAP generate a structure similar to the Google > > structure? Ohh and from my PEAR::SOAP server the SOAP-ENC namespace > points > > to the same location as Google's ns3. > > > > Thanks, > > Rob > > > > > >

« previous php.soap (#571) next »