at first i had two c++ server and client program, run two program on a local computer separately and input a name in client side, then server will recieve request and send back the phone number and display on the client side. after complie with gsoap, Here is what i got the wsdl file.
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="test"
targetNamespace="test"
xmlns:tns="test"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:test="test"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="test"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:test="test"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
<!-- operation request element -->
<element name="getMobile">
<complexType>
<sequence>
<element name="user" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/><!-- test__getMobile::user -->
</sequence>
</complexType>
</element>
<!-- operation response element -->
<element name="getMobileResponse">
<complexType>
<sequence>
<element name="phone-num" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/><!-- test__getMobile::phone_num -->
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="getMobileRequest">
<part name="parameters" element="test:getMobile"/><!-- test__getMobile::test__getMobile -->
</message>
<message name="getMobileResponse">
<part name="parameters" element="test:getMobileResponse"/>
</message>
<portType name="testPortType">
<operation name="getMobile">
<documentation>Service definition of function test__getMobile</documentation>
<input message="tns:getMobileRequest"/>
<output message="tns:getMobileResponse"/>
</operation>
</portType>
<binding name="test" type="tns:testPortType">
<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getMobile">
<SOAP:operation soapAction=""/>
<input>
<SOAP:body parts="parameters" use="literal"/>
</input>
<output>
<SOAP:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="test">
<documentation>gSOAP 2.8.3 generated service definition</documentation>
<port name="test" binding="tns:test">
<SOAP:address location="http://192.168.82.52:35088"/>
</port>
</service>
</definitions>
now should i create two separated php file in two folders one php file should be enough?ive check some code on the internet but still not quite sure where o step in…
thanks!
and for my c++ program function, if i want to hard code user input in php, should i do
$result = $sc->getMobile("Grace");
or sould i put a array in it?
Not sure what you are trying to do here – are you trying to write the client side program? What have you got so far?
You can parse the xml string that is returned from the SOAP request using SimpleXMLElement:
Reference on SimpleXMLElement located here: http://php.net/manual/en/class.simplexmlelement.php