Uncaught SoapFault exception: [VersionMismatch] Wrong Version. В чем соль?

Друзья, нужно зделать обмен между 1с 8.2 и сайтом.
Вот схема которую дал разрабоччик 1c:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12bind="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost/WebExchange" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://localhost/WebExchange" name="WebExchange" targetNamespace="http://localhost/WebExchange">
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xs1="http://localhost/WebExchange" targetNamespace="http://localhost/WebExchange" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:complexType name="product">
<xs:sequence>
<xs:element name="articul" type="xs:string"/>
<xs:element name="id" type="xs:int"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="quantity" type="xs:float"/>
<xs:element name="price" type="xs:float"/>
<xs:element name="group_id" type="xs:int"/>
<xs:element name="group_name" type="xs:string"/>
<xs:element name="is_group" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="products">
<xs:sequence>
<xs:element name="product_line" type="tns:product" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Import_order">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="Import_orderResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Export_products">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="Export_productsResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="tns:products" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</types>
<message name="Import_orderRequestMessage">
<part name="parameters" element="tns:Import_order"/>
</message>
<message name="Import_orderResponseMessage">
<part name="parameters" element="tns:Import_orderResponse"/>
</message>
<message name="Export_productsRequestMessage">
<part name="parameters" element="tns:Export_products"/>
</message>
<message name="Export_productsResponseMessage">
<part name="parameters" element="tns:Export_productsResponse"/>
</message>
<portType name="WebExchangePortType">
<operation name="Import_order">
<input message="tns:Import_orderRequestMessage"/>
<output message="tns:Import_orderResponseMessage"/>
</operation>
<operation name="Export_products">
<input message="tns:Export_productsRequestMessage"/>
<output message="tns:Export_productsResponseMessage"/>
</operation>
</portType>
<binding name="WebExchangeSoapBinding" type="tns:WebExchangePortType">
<soapbind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Import_order">
<soapbind:operation style="document" soapAction="http://localhost/WebExchange#WebExchange:Import_order"/>
<input>
<soapbind:body use="literal"/>
</input>
<output>
<soapbind:body use="literal"/>
</output>
</operation>
<operation name="Export_products">
<soapbind:operation style="document" soapAction="http://localhost/WebExchange#WebExchange:Export_products"/>
<input>
<soapbind:body use="literal"/>
</input>
<output>
<soapbind:body use="literal"/>
</output>
</operation>
</binding>
<binding name="WebExchangeSoap12Binding" type="tns:WebExchangePortType">
<soap12bind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Import_order">
<soap12bind:operation style="document" soapAction="http://localhost/WebExchange#WebExchange:Import_order"/>
<input>
<soap12bind:body use="literal"/>
</input>
<output>
<soap12bind:body use="literal"/>
</output>
</operation>
<operation name="Export_products">
<soap12bind:operation style="document" soapAction="http://localhost/WebExchange#WebExchange:Export_products"/>
<input>
<soap12bind:body use="literal"/>
</input>
<output>
<soap12bind:body use="literal"/>
</output>
</operation>
</binding>
<service name="WebExchange">
<port name="WebExchangeSoap" binding="tns:WebExchangeSoapBinding">
<documentation>
<wsi:Claim xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" conformsTo="http://ws-i.org/profiles/basic/1.1"/>
</documentation>
<soapbind:address location="http://78.46.43.174/CMA_NEW/ws/WebExchange.1cws"/>
</port>
<port name="WebExchangeSoap12" binding="tns:WebExchangeSoap12Binding">
<soap12bind:address location="http://78.46.43.174/CMA_NEW/ws/WebExchange.1cws"/>
</port>
</service>
</definitions>

Запрос типа:
var_dump($client->__getFunctions());
Возвращает:
/*
        0 => string 'Import_orderResponse Import_order(Import_order $parameters)' (length=59)
        1 => string 'Export_productsResponse Export_products(Export_products $parameters)' (length=68)
        2 => string 'Import_orderResponse Import_order(Import_order $parameters)' (length=59)
        3 => string 'Export_productsResponse Export_products(Export_products $parameters)' (length=68)
 */


Вот мой код, дает ексцепшин:
public function test()
    {
        $client = new \SoapClient(
            $this->url,
            array(
                'login'         => $this->username,
                'password'      => $this->password,
                'soap_version'  => SOAP_1_2,
                'location'      => $this->url,
                'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
                'trace' => 1
            )
        );

        try {
            $result = $client->Export_products();
            var_dump($result);
        } catch (\Exception $e) {
            print $e->getMessage() ."\n";

            print $client->__getLastRequest();

            print $client->__getLastResponse();
        }
    }

Fatal error: Uncaught SoapFault exception: [VersionMismatch] Wrong Version in

Информация о php:
PHP Version 7.0.13-0ubuntu0.16.04.1
/etc/php/7.0/apache2/conf.d/20-simplexml.ini, /etc/php/7.0/apache2/conf.d/20-soap.ini,
  • Вопрос задан
  • 3298 просмотров
Решения вопроса 1
wmgodyak
@wmgodyak Автор вопроса
Решено.
Нужно сохранить wsdl респонс, подключить в конструкторе и указать location без ?wsdl

$client = new \SoapClient
        (
            DOCROOT . "ex.wsdl" ,
            [
                'login'         => $this->username,
                'password'      => $this->password,
                'soap_version'  => '1.2',
                'cache_wsdl'    => WSDL_CACHE_NONE, 
                'features'      => SOAP_USE_XSI_ARRAY_TYPE,
                'location'      => $this->location,
                'exceptions'  => true,
                'trace'       => true
            ]
        );
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы