Skip to content

Instantly share code, notes, and snippets.

@Gemorroj Gemorroj/client.php
Created Jun 13, 2017

Embed
What would you like to do?
php bug #74679
<?php
$client = new SoapClient(__DIR__ . '/test.wsdl', array(
'trace' => true,
'exceptions' => true,
'cache_wsdl' => WSDL_CACHE_NONE,
));
$client->receiveEDIMessages();
echo $client->__getLastResponse();
<?php
$server = new SoapServer(__DIR__ . '/test.wsdl', array(
'cache_wsdl' => WSDL_CACHE_MEMORY // <- problem here
));
$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
),
);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:tns="urn:private" 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/" name="private" targetNamespace="urn:private">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:private">
<xsd:complexType name="confirmReceiveEDIMessagesResponse">
<xsd:sequence>
<xsd:element name="head" type="tns:headResponse"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="headResponse">
<xsd:sequence>
<xsd:annotation>
<xsd:documentation xml:lang="ru">Код и описание ошибки. Если все хорошо, то код ошибки 0, описания ошибки нету.</xsd:documentation>
</xsd:annotation>
<xsd:element name="code" type="xsd:int"/>
<xsd:element name="message" type="xsd:string" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
<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>
<xsd:complexType name="receiveEDIMessagesResponse">
<xsd:sequence>
<xsd:element name="head" type="tns:headResponse"/>
<xsd:element name="body" type="tns:bodyMessagesResponse" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="receiveEDIMessages"/>
<message name="receiveEDIMessagesResponse">
<part name="receiveEDIMessagesReturn" type="tns:receiveEDIMessagesResponse"/>
</message>
<portType name="ApiPortType">
<documentation>Приватный Web-сервис</documentation>
<operation name="receiveEDIMessages">
<documentation>Отправка исходящих EDI сообщений</documentation>
<input message="tns:receiveEDIMessages"/>
<output message="tns:receiveEDIMessagesResponse"/>
</operation>
</portType>
<binding name="ApiBinding" type="tns:ApiPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="receiveEDIMessages">
<soap:operation soapAction="urn:ApiAction"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:interface"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:interface"/>
</output>
</operation>
</binding>
<service name="interfacePrivateService">
<port name="ApiPort" binding="tns:ApiBinding">
<soap:address location="http://test.loc/server.php"/> <!-- CHANGE THIS -->
</port>
</service>
</definitions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.