RE: Namespace Issues
| From: | Fernando | Date: | Tue, 08 Jul 2003 09:30:22 +0000 |
| Subject: | RE: Namespace Issues | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-757@lists.php.net to get a copy of this message | ||
Changing ns4 to xms:
$sc=new objServer();
$server = new soap_server;
$server->addObjectMap($sc,'urn:xtics_rpc');
$server->_namespaces['urn:xtics_rpc']='xms';
Creating SOAP_Values:
...
$vs[] =& new SOAP_Value('{urn:xtics_rpc}Venue','Venue',$vals);
...
----------------------------------------------------------------------------
---------------
Original message:
----------------------------------------------------------------------------
---------------
List,
I'm trying to build a SOAP server with PEAR::SOAP that will respond to a
client written in Java. The fella on the other end says his java client is
having issues with my namespace. He complains that the namespace for Venue
is unqualified but should be in ns4. How can I change the name of ns4 to
"xms" and how can I qualify the Venue with that name space?
I build like this:
// SOAP Constructor
$svr =& new SOAP_Server;
$sc =& new xtics_rpc();
$svr->addObjectMap($sc,'urn:xtics_rpc');
$svr->service($HTTP_RAW_POST_DATA);
// Then this is in a function that gets called
while (xyz)
{
$vals = array(
new SOAP_Value("id",'int',$v[0]),
new SOAP_Value('name','string',$v[1]),
new SOAP_Value("city",'string',$v[2]),
new SOAP_Value('province','string',$v[3]),
new SOAP_Value('country','string',$v[4])
);
$vs[] =& new SOAP_Value('ns4:Venue','Venue',$vals);
}
return $vs;
// That sends back this XML
<SOAP-ENV:Envelope xmlns:ns4="urn:xtics_rpc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:get_venuesResponse>
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Venue[2]"
SOAP-ENC:offset="[0]">
<Venue>
<id xsi:type="xsd:int">100000</id>
<name xsi:type="xsd:string">~Unknown</name>
<city xsi:type="xsd:string">Unknown</city>
<province xsi:type="xsd:string" />
<country xsi:type="xsd:string">USA</country>
</Venue>
<Venue>
<id xsi:type="xsd:int">100002</id>
<name xsi:type="xsd:string">Kiva Auditorium</name>
<city xsi:type="xsd:string">Albuquerque</city>
<province xsi:type="xsd:string">NM</province>
<country xsi:type="xsd:string">USA</country>
</Venue>
</return>
</ns4:get_venuesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
David Busby
Systems Engineer
busby@pnts.com