title: How to create php SOAP Server functions using WSDL?
body: <p>I want to create PHP SOAP Server, but don't understand how to do it correctly. So below is the <strong>server.php</strong> file:</p>
  
  <pre><code>&lt;?php
  
  class NewOperation {
      public function NewOperation()
      {
  
      }
  }
  
  ini_set("soap.wsdl_cache_enabled", "0");
  $server = new SOAPServer('http://localhost:9080/soap-websiteservice-        wsdl/CalculatorService.wsdl', array(
      'soap_version' =&gt; SOAP_1_2,
      'style' =&gt; SOAP_RPC,
      'use' =&gt; SOAP_LITERAL
  ));
  $server-&gt;setClass('NewOperation');
  $server-&gt;handle();
  </code></pre>
  
  <p>The <strong>client.php file</strong>:</p>
  
  <pre><code>&lt;?php
  // client.php
  $options = array(
      'trace' =&gt; true
  );
  $client = new SOAPClient('http://localhost:9080/soap-websiteservice-    wsdl/server.php?wsdl', $options);
  var_dump($client-&gt;NewOperation());
  </code></pre>
  
  <p>The <strong>wsdl file</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"     xmlns:tns="http://localhost:9080/soap-websiteservice-wsdl/CalculatorService/"     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"     xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CalculatorService"     targetNamespace="http://localhost:9080/soap-websiteservice-    wsdl/CalculatorService/"&gt;
    &lt;wsdl:types&gt;
      &lt;xsd:schema targetNamespace="http://localhost:9080/soap-websiteservice-    wsdl/CalculatorService/"&gt;
        &lt;xsd:element name="add" type="xsd:string"&gt;
  
        &lt;/xsd:element&gt;
    &lt;xsd:element name="addResponse"&gt;
      &lt;xsd:complexType&gt;
        &lt;xsd:sequence&gt;
          &lt;xsd:element name="addResponse" type="tns:addResponseType" /&gt;
        &lt;/xsd:sequence&gt;
      &lt;/xsd:complexType&gt;
    &lt;/xsd:element&gt;
  
    &lt;xsd:complexType name="addRequestType"&gt;
      &lt;xsd:sequence&gt;
          &lt;xsd:element name="num1" type="xsd:int"&gt;&lt;/xsd:element&gt;
          &lt;xsd:element name="num2" type="xsd:int"&gt;&lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
  
    &lt;xsd:complexType name="addResponseType"&gt;
      &lt;xsd:sequence&gt;
          &lt;xsd:element name="result" type="xsd:string"&gt;&lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
          &lt;xsd:element name="in" type="xsd:string"&gt;&lt;/xsd:element&gt;
          &lt;xsd:element name="NewOperationResponse"&gt;
              &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
                      &lt;xsd:element name="out" type="xsd:string"&gt;&lt;/xsd:element&gt;
                  &lt;/xsd:sequence&gt;
              &lt;/xsd:complexType&gt;
          &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="addRequest"&gt;
  &lt;wsdl:part element="tns:add" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="addResponse"&gt;
  &lt;wsdl:part element="tns:addResponse" name="parameters"/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="NewOperationRequest"&gt;
  &lt;wsdl:part name="NewOperationRequest" element="tns:in"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="NewOperationResponse"&gt;
      &lt;wsdl:part name="parameters" element="tns:NewOperationResponse"&gt;        &lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
  &lt;wsdl:portType name="CalculatorService"&gt;
  
  &lt;wsdl:operation name="NewOperation"&gt;
      &lt;wsdl:input message="tns:NewOperationRequest"&gt;&lt;/wsdl:input&gt;
      &lt;wsdl:output message="tns:NewOperationResponse"&gt;&lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:portType&gt;
  &lt;wsdl:binding name="CalculatorServiceSOAP"
  type="tns:CalculatorService"&gt;
  &lt;soap:binding style="document"
      transport="http://schemas.xmlsoap.org/soap/http" /&gt;
  &lt;wsdl:operation name="NewOperation"&gt;
      &lt;soap:operation
          soapAction="http://localhost:9080/soap-websiteservice-        wsdl/CalculatorService/NewOperation" /&gt;
      &lt;wsdl:input&gt;
          &lt;soap:body use="literal" /&gt;
      &lt;/wsdl:input&gt;
      &lt;wsdl:output&gt;
          &lt;soap:body use="literal" /&gt;
      &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:binding&gt;
  &lt;wsdl:service name="CalculatorService"&gt;
  &lt;wsdl:port binding="tns:CalculatorServiceSOAP" name="CalculatorServiceSOAP"&gt;
    &lt;soap:address location="http://localhost:9080/soap-websiteservice-wsdl/"/&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p><a href="https://postimg.org/image/59mzy8lxj/" rel="nofollow noreferrer">Image from eclipse</a></p>
  
  <p><a href="http://www.filedropper.com/soap" rel="nofollow noreferrer">Zipped all files</a></p>
  
  <p>I created WSDL file with Eclipse web service XML editor. Now I do not know how to create functions. I get the following error: </p>
  
  <blockquote>
    <p>Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in C:\wamp\www\soap-websiteservice-wsdl\client.php:7 Stack trace: #0 [internal function]: SoapClient->__doRequest('http://localhos...', '<a href="http://localhos" rel="nofollow noreferrer">http://localhos</a>...', 1, 0) #1 C:\wamp\www\soap-websiteservice-wsdl\client.php(7): SoapClient->__call('NewOperation', Array) #2 C:\wamp\www\soap-websiteservice-wsdl\client.php(7): SoapClient->NewOperation() #3 {main} thrown in C:\wamp\www\soap-websiteservice-wsdl\client.php on line 7</p>
  </blockquote>