Web Services PHP - Grid .NET Step By Step Tutorial - Part 1: One of my friend ask me how to catch php web service and show in grid at vb.net. Ok, in this series tutorial, I will show how to catch data array and show use grid. I use PHP 5 and Ms Visual Studio 2003.
We use WSDL and SOAP to transmit data. But there is limited that we must know. VS 2003 don't know xsd:restriction and soapenc at WSDL document (if you still don't know about this, you can read before this). Without this element, we can not transmit array data. So, how can we solve this problem?
We can still use string to transport array. How? Example, we have array like this:
array(array('id'=>1,'title'=>'PHP API')
array('id'=>2,'title'=>'PHP Web 2.0')
)
We can manipulate become string such as:
1|PHP API#2|PHP Web 2.0
Each row is separated with # character, then each item is separated with #. This is basic idea.
Below, our WSDL:
<?xml version="1.0"?>
<definitions name="Library" targetNamespace="urn:Library" xmlns:tns="urn:Library" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Library">
</xsd:schema>
</types>
<message name="doLibraryRequest">
<part name="name" type="xsd:string" />
</message>
<message name="doLibraryResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="LibraryPort">
<operation name="doLibrary">
<input message="tns:doLibraryRequest" />
<output message="tns:doLibraryResponse" />
</operation>
</portType>
<binding name="LibraryBinding" type="tns:LibraryPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="doLibrary">
<soap:operation soapAction="urn:Library#doLibrary" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:Library" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:Library" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="LibraryService">
<port name="LibraryPort" binding="tns:LibraryBinding">
<soap:address location="http://localhost/test/wsdl/library_server.php" />
</port>
</service>
</definitions>
Create a file named "library.wsdl" within www/test/wsdl. Enter above code.