I don't kow if this is the right place or not for this. If not, sorry. Direct me and I will go somewhere else.
I am new and struggling to get this to work for me.
I have enclosed all code, in an effort to be complete. If it is too much, I apologize. Here is my situation
:
I create a nusoap web service using php5 on FreeBSD with apache ws. The service selects some records from a PostgreSQL db and attempts to return the serialized rows. I set up complex types for return data as shown below. The data is actually returned correctly, however the type information is missing from the return and item tags. This causes the (very picky) .NET client to return a "Namespace prefix "" is not defined" error. Any ideas why nusoap is leaving out the type? Here is server code:
require_once("nusoap.php");
$NAMESPACE = 'array_handler';
$server = new soap_server;
//Initialize wsdl support
$server->configureWSDL('array_handler', $NAMESPACE);
$server->wsdl->schemaTargetNamespace = $NAMESPACE;
$server->wsdl->addComplexType(
'ArrayOfstring',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')
),
'xsd:string'
);
$server->wsdl->addComplexType(
'ArrayOfArrays',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:ArrayOfstring[]'))
);
$server->register('procquery', //method name
array('input' => 'xsd:string'),
array('return'=>'tns:ArrayOfArrays'),
$NAMESPACE
);
function procquery($input){
$dbconn = pg_pconnect("host='server1' dbname='test' user='myusername' password='somepassword'");
$result=pg_query($dbconn,'Select * from test1');
$rows = pg_fetch_all($result);
return $rows;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA,"yes");
And here is the XML that is produced:
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:EnvelopeSOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding
/"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:S
OAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<ns1:procqueryResponse xmlns:ns1="array_handler">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":[2]">
<item xsi:type="xsd:">
<fname xsi:type="xsd:string">John</fname>
<lname xsi:type="xsd:string">Smith</lname>
<st_addr_1 xsi:type="xsd:string">1234 Home St</st_addr_1>
</item>
<item xsi:type="xsd:">
<fname xsi:type="xsd:string">Jeff</fname>
<lname xsi:type="xsd:string">Jones</lname>
<st_addr_1 xsi:nil="true"/>
</item>
</return>
</ns1:procqueryResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
NOTICE that the lines ---
SOAP-ENC:arrayType=":[2]">
<item xsi:type="xsd:">
are both missing the type.
What am I doing wrong ?
Thanks alot
Jeff