T
T
tatarrr952018-02-26 07:56:43
PHP
tatarrr95, 2018-02-26 07:56:43

How to write a soap request in php for a given wsdl?

There is a wsdl file

<?xml version="1.0"  encoding="UTF-8" ?>
<definitions 
  xmlns="http://schemas.xmlsoap.org/wsdl/" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  name="esia_usl" 
  targetNamespace="urn:TFOMS-EsiaUsl" 
  xmlns:tns="urn:TFOMS-EsiaUsl" 
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"   
  >
<types>
    <xs:schema 
      xmlns:xs="http://www.w3.org/2001/XMLSchema" 			
      targetNamespace="urn:TFOMS-EsiaUsl" 
      elementFormDefault="qualified" 
      xmlns:tns="urn:TFOMS-EsiaUsl"
    >	
    <xs:complexType name="InputParams">
      <xs:sequence>
        <xs:element name="fam" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="im" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="ot" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
        <xs:element name="dr" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="dmin" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="dmax" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
      </xs:sequence>  
    </xs:complexType>    

    <xs:complexType name="Usl">
      <xs:sequence>
        <xs:element name="lpu" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="nmlpu" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>            
        <xs:element name="smo" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>            
        <xs:element name="nmusl" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="uslok" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="ds" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>                        
        <xs:element name="dtbeg" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>
        <xs:element name="dtend" type="xs:string" minOccurs="1" maxOccurs="1"></xs:element>            
        <xs:element name="sum" type="xs:decimal" minOccurs="1" maxOccurs="1"></xs:element>
      </xs:sequence>  
    </xs:complexType>   

    <xs:complexType name="UslData">
      <xs:sequence>
        <xs:element name="usl" type="tns:Usl" minOccurs="0" maxOccurs="unbounded"></xs:element>
      </xs:sequence>  
    </xs:complexType>   

   </xs:schema> 
</types>      
  <message name="request_msg">
    <part name="input_params" type="tns:InputParams"/>    
  </message>
  <message name="response_msg">
    <part name="usl_list" type="tns:UslData"/>
  </message>  
  <portType name="EsiaUslType">
    <operation name="getUsl">
      <input message="tns:request_msg"/>
      <output message="tns:response_msg"/>
    </operation>   
  </portType>
  <binding name="EsiaUslBinding" type="tns:EsiaUslType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getUsl">
      <soap:operation soapAction="" style="document"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>    
  </binding>
  <service name="EsiaUslService">
    <port name="EsiaUslPort" binding="tns:EsiaUslBinding">
      <soap:address location="http://site/server_esia.php"/>
    </port>
  </service>
</definitions>

How to write a query with parameters fam, im, ot, dr, dmin and dmax to get a response? At the same time, fam im and ot convey Russian characters in themselves.
I understand that you need to start with and then a dead end, how to make a request)
$client = new SoapClient("http://site/esia.wsdl");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2018-02-26
@402d

php.net/manual/ru/soapclient.getfunctions.php
var_dump($client->__getFunctions());
you get a list
and then just
$result = $client->function_name(parameter, ...);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question