Re: bug in client? xml in the soap body

From: Date: Mon, 23 Jun 2003 10:35:38 +0000
Subject: Re: bug in client? xml in the soap body
References: 1 2  Groups: php.soap 
Request: Send a blank email to php-soap+get-723@lists.php.net to get a copy of this message
I've tried overwriting function __set_attribute but it's impossible to retrieve all the attributes. The complete example: ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ SERVER: (soapserver.php) <? include("SOAP/Server.php"); function toText($mix) { ob_start(); print_r($mix); $txt=ob_get_contents(); ob_end_clean(); return $txt; } class soapCL { function exFunction1($obj) { return toText($obj); } function exFunction2($obj) { $a=array(new SOAP_value('item','string','a',array('attr'=>'i1')) ,new SOAP_value('item','string','b',array('attr'=>'i2'))); $a1=new SOAP_value('level1',NULL,$a,array('attr'=>'l1')); return $a1; } } $sc=new soapCL(); $server = new soap_server; $server->addObjectMap($sc,'namespace'); $server->service($HTTP_RAW_POST_DATA); ?> ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ CLIENT: (soapclient.php) <?php require_once("SOAP/Client.php"); $soapclient = new soap_client('http://localhost/soapserver.php'); $a=array(new SOAP_value('item','string','1',array('attr'=>'i1')) ,new SOAP_value('item','string','1',array('attr'=>'i2'))); $a1=new SOAP_value('level1',NULL,$a,array('attr'=>'l1')); $options = array('namespace' => 'namespace', 'trace' => 1); echo "function 1:\r\n"; $res=$soapclient->call('exFunction1',$a1,$options); print_r($res); echo "function 2:\r\n"; $res=$soapclient->call('exFunction2',$a1,$options); print_r($res); ?> ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ MESSAGE result output: function 1: Array ( [0] => 1 [1] => 1 ) function 2: Array ( [0] => a [1] => b ) ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ MESSAGE call function 1: POST /soapserver.php HTTP/1.0 User-Agent: PEAR-SOAP 0.7.3-devel Host: xxxxxxxx Content-Type: text/xml; charset=UTF-8 Content-Length: 684 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="namespace" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns4:exFunction1> <level1 xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]" SOAP-ENC:offset="[0]" attr="l1"> <item xsi:type="xsd:string" attr="i1">1</item> <item xsi:type="xsd:string" attr="i2">1</item></level1></ns4:exFunction1> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ MESSAGE response function 1: <?xml version="1.0" encoding="UTF-8" ?> - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="namespace"SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap /encoding/"> - <SOAP-ENV:Body> - <ns4:exFunction1Response> <returnxsi:type="xsd:string">Array ( [0] => 1 [1] => 1 )</return> </ns4:exFunction1Response> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ MESSAGE call function 2: POST /soapserver.php HTTP/1.0 User-Agent: PEAR-SOAP 0.7.3-devel Host: xxxxxxxx Content-Type: text/xml; charset=UTF-8 Content-Length: 684 SOAPAction: "" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="namespace" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns4:exFunction2> <level1 xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]" SOAP-ENC:offset="[0]" attr="l1"> <item xsi:type="xsd:string" attr="i1">1</item> <item xsi:type="xsd:string" attr="i2">1</item></level1></ns4:exFunction2> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ---------------------------------------------------------------------------- ------------------ ---------------------------------------------------------------------------- ------------------ MESSAGE response function 2: <?xml version="1.0" encoding="UTF-8" ?> - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="namespace"SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap /encoding/"> - <SOAP-ENV:Body> - <ns4:exFunction2Response> - <level1xsi:type="SOAP-ENC:Array"SOAP-ENC:arrayType="xsd:string[2]"SOAP-ENC:o ffset="[0]"attr="l1"> <itemxsi:type="xsd:string"attr="i1">a</item> <itemxsi:type="xsd:string"attr="i2">b</item> </level1> </ns4:exFunction2Response> </SOAP-ENV:Body> </SOAP-ENV:Envelope> "Andrew S. Nagy" <asnagy@lsb.syr.edu> escribió en el mensaje news:PNEFIMKMKOJKCDJEIEODCEFMCDAA.asnagy@lsb.syr.edu... > I am trying to consume a soap response where the results are listed as a > sting, but the string is an actual xml document with all of the brackets > turned into &gt; and &lt; > > However the soap client throws a soap_fault with the message: > XML error on line 9414 col 33 byte 999069 not well-formed (invalid token) > > According to the group offering the web service, it is a working and > well-formed xml document. Even though I told them that publishing an XML > document via soap is kinda pointless, it should still work though, right? > > Has anyone ever tried to consume xml through SOAP before? Will PEAR::SOAP > allow this? > > > -----Original Message----- > > From: Fernando [mailto:fgarcia@uef.es] > > Sent: Thursday, June 19, 2003 2:51 PM > > To: soap@lists.php.net > > Subject: [SOAP] retrieving attributes SOAP(PEAR) > > > > > > > > I have this structure: > > > > <soap-env:Envelope > > > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> > > > > <soap-env:body> > > <ns4:function> > > <ns4:level1 attr="l1"> > > <ns4:item attr="i1"/> > > <ns4:item attr="i2"/> > > </ns4:level1> > > </ns4:function> > > <soap-env:body> > > > > </soap-env:Envelope> > > > > > > > > > > I don't know how to get the node names (level1/item/item) and attribute > > values (attr/l1/i1/i2) in SOAP (PEAR) server. Is it possible? > > Any idea? > > thanks > > Fernando > > > > > > > > -- > > PHP Soap Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.soap (#723) next »