I can't access to parameters (thought everything seems to be fine, no error returned) :
<?php
// Class that is called by soap server handle function
class MyClass {
// function that correspond to operation name in wsdl file
public function MdBSpieGetInformationPasseport($myParam) {
// This code is well executed
// But how can i read here IDENTIFIANT parameter ?
// It seems there's nothing in $myParam
// I know i can read $HTTP_RAW_POST_DATA here
// but it should have been parsed automatically, no ?
}
}
$server = new SoapServer('testWs.wsdl');
$server->setClass('MyClass');
$server->handle();
?>
Here is the wsdl file (testWs.wsdl) :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="wsTest" xmlns:spie="wsTest">
<wsdl:types>
<xsd:schema>
<xsd:import schemaLocation="http://testws.local/?pg=xsd" namespace="wsTest" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="MdBSpieGetInformationPasseportInput">
<wsdl:part element="spie:MdBSpieBovinRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="MdBSpieGetInformationPasseportOutput">
<wsdl:part element="spie:MdBSpieGetInformationPasseportResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="wsTestPortType">
<wsdl:operation name="MdBSpieGetInformationPasseport">
<wsdl:input message="spie:MdBSpieGetInformationPasseportInput"/>
<wsdl:output message="spie:MdBSpieGetInformationPasseportOutput"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="wsTestBinding" type="spie:wsTestPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="MdBSpieGetInformationPasseport">
<soap:operation soapAction="http://testWs.local/?pg=ws"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="wsTest">
<wsdl:port name="wsTestBinding" binding="spie:wsTestBinding">
<soap:address location="http://testWs.local/?pg=ws" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
And the testWs.xsd file embedded :
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:spie="wsTest" targetNamespace="wsTest" elementFormDefault="qualified">
<xsd:element name="MdBSpieBovinRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Authentification" type="spie:typeAuthentificationRequest"/>
<xsd:element name="Bovin" type="spie:typeBovinRequest"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="typeAuthentificationRequest">
<xsd:sequence>
<xsd:element name="IDENTIFIANT">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="20"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="MOT_DE_PASSE">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="typeBovinRequest">
<xsd:sequence>
<xsd:element name="CODE_PAYS">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="2" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="NUMERO_ANIMAL">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="MdBSpieGetInformationPasseportResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ReponseStandard" type="spie:typeReponseStandard"/>
<xsd:element name="ReponseSpecifique" type="spie:typeReponseInformationPasseport" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="typeReponseStandard">
<xsd:sequence>
<xsd:element name="Resultat" type="xsd:boolean"/>
<xsd:element name="Anomalie" type="spie:typeAnomalie" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="typeAnomalie">
<xsd:sequence>
<xsd:element name="CODE_ANOMALIE">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="/^9MdBSpie/"></xsd:pattern>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SEVERITE_ANOMALIE" type="xsd:integer"/>
<xsd:element name="MESSAGE_ANOMALIE" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="typeReponseInformationPasseport">
<xsd:sequence>
<xsd:element name="NUTRAV">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="4"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="COPAIP">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="NUNATI">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="12"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="SEXBOV" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CORABO" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DANAIS" type="xsd:date" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I use SoapUI to send soap request. Here is what i see in SoapUI request window :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="wsTest">
<soapenv:Header/>
<soapenv:Body>
<wst:MdBSpieBovinRequest>
<wst:Authentification>
<wst:IDENTIFIANT>soapid</wst:IDENTIFIANT>
<wst:MOT_DE_PASSE>soappasswd</wst:MOT_DE_PASSE>
</wst:Authentification>
<wst:Bovin>
<wst:CODE_PAYS>soappays</wst:CODE_PAYS>
<wst:NUMERO_ANIMAL>soapanimal</wst:NUMERO_ANIMAL>
</wst:Bovin>
</wst:MdBSpieBovinRequest>
</soapenv:Body>
</soapenv:Envelope>
Notice that wst: appeared and i don't know where it comes from. Is there an error in my sdl file ?
And in SoapUI response window :
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="wsTest">
<SOAP-ENV:Body>
<ns1:MdBSpieGetInformationPasseportResponse/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Thank you for helping
PHP 5.3.9
EDIT : First error was in SoapServer instanciation (http://www.php.net/manual/fr/soapserver.soapserver.php#102143) :
$server = new \SoapServer('http://myprojet.local?wsdl'); // correct