|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-05-31 12:58 UTC] wapinet at mail dot ru
Description:
------------
php code:
$server = new SoapServer('my.wsdl');
$server->setClass(Api::class);
$server->handle();
class Api
{
public function receiveEDIMessages()
{
return array(
'head' => null,
'body' => array(
'message' => 'text',
'from' => '2352457999993',
'to' => '2352456999994',
'id' => 54370
),
);
}
}
WSDL (use rpc style):
<xsd:complexType name="bodyMessagesResponse">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:messageResponse[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="messageResponse">
<xsd:sequence>
<xsd:element name="message" type="xsd:string"/>
<xsd:element name="from" type="xsd:string"/>
<xsd:element name="to" type="xsd:string"/>
<xsd:element name="id" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
response php 5.6:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:receiveEDIMessagesResponse>
<receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse">
<head xsi:type="ns2:headResponse">
<code xsi:type="xsd:int">0</code>
<message xsi:nil="true"/>
</head>
<body SOAP-ENC:arrayType="ns2:messageResponse[1]" xsi:type="ns2:bodyMessagesResponse">
<item xsi:type="ns2:messageResponse">
<message xsi:type="xsd:string">text</message>
<from xsi:type="xsd:string">2352457999993</from>
<to xsi:type="xsd:string">2352456999994</to>
<id xsi:type="xsd:integer">54370</id>
</item>
</body>
</receiveEDIMessagesReturn>
</ns1:receiveEDIMessagesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
response php 7.x:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:ns3="http_://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:receiveEDIMessagesResponse>
<receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse">
<head xsi:type="ns2:headResponse">
<code xsi:type="xsd:int">0</code>
<message xsi:nil="true"/>
</head>
<body SOAP-ENC:arrayType="ns3:Map[1]" xsi:type="ns2:bodyMessagesResponse">
<item xsi:type="ns3:Map">
<item>
<key xsi:type="xsd:string">message</key>
<value xsi:type="xsd:string">text</value>
</item>
<item>
<key xsi:type="xsd:string">from</key>
<value xsi:type="xsd:string">2352457999993</value>
</item>
<item>
<key xsi:type="xsd:string">to</key>
<value xsi:type="xsd:string">2352456999994</value>
</item>
<item>
<key xsi:type="xsd:string">id</key>
<value xsi:type="xsd:string">54370</value>
</item>
</item>
</body>
</receiveEDIMessagesReturn>
</ns1:receiveEDIMessagesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Expected result:
----------------
response php 5.6 is actual result
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
Description: ------------ php code: $server = new SoapServer('my.wsdl'); $server->setClass(Api::class); $server->handle(); class Api { public function receiveEDIMessages() { return array( 'head' => null, 'body' => array( array( 'message' => 'text', 'from' => '2352457999993', 'to' => '2352456999994', 'id' => 54370 ) ), ); } } WSDL (use rpc style): <xsd:complexType name="bodyMessagesResponse"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:messageResponse[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="messageResponse"> <xsd:sequence> <xsd:element name="message" type="xsd:string"/> <xsd:element name="from" type="xsd:string"/> <xsd:element name="to" type="xsd:string"/> <xsd:element name="id" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> response php 5.6: <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:receiveEDIMessagesResponse> <receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse"> <head xsi:type="ns2:headResponse"> <code xsi:type="xsd:int">0</code> <message xsi:nil="true"/> </head> <body SOAP-ENC:arrayType="ns2:messageResponse[1]" xsi:type="ns2:bodyMessagesResponse"> <item xsi:type="ns2:messageResponse"> <message xsi:type="xsd:string">text</message> <from xsi:type="xsd:string">2352457999993</from> <to xsi:type="xsd:string">2352456999994</to> <id xsi:type="xsd:integer">54370</id> </item> </body> </receiveEDIMessagesReturn> </ns1:receiveEDIMessagesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> response php 7.x: <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:ns3="http_://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:receiveEDIMessagesResponse> <receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse"> <head xsi:type="ns2:headResponse"> <code xsi:type="xsd:int">0</code> <message xsi:nil="true"/> </head> <body SOAP-ENC:arrayType="ns3:Map[1]" xsi:type="ns2:bodyMessagesResponse"> <item xsi:type="ns3:Map"> <item> <key xsi:type="xsd:string">message</key> <value xsi:type="xsd:string">text</value> </item> <item> <key xsi:type="xsd:string">from</key> <value xsi:type="xsd:string">2352457999993</value> </item> <item> <key xsi:type="xsd:string">to</key> <value xsi:type="xsd:string">2352456999994</value> </item> <item> <key xsi:type="xsd:string">id</key> <value xsi:type="xsd:string">54370</value> </item> </item> </body> </receiveEDIMessagesReturn> </ns1:receiveEDIMessagesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Expected result: ---------------- response php 5.6 is actual result