title: consume a php soap service from C#
body: <p>I have made a simple web service</p>
  
  <p>wsdl:</p>
  
  <pre><code>&lt;wsdl:definitions name='mysum' &gt;
  
  &lt;wsdl:types&gt;
   &lt;xsd:schema 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.my-uni-project.info/joomla/components/com_jv_vm_soa/"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="mysum"
     targetNamespace="http://www.my-uni-project.info/joomla/components/com_jv_vm_soa/"
     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"&gt;
  
     &lt;xsd:complexType name="mysumRequest"&gt;
      &lt;xsd:all&gt;
       &lt;xsd:element minOccurs="0" name="n1" type="xsd:int"/&gt;
       &lt;xsd:element minOccurs="0" name="n2" type="xsd:int"/&gt;
      &lt;/xsd:all&gt;
     &lt;/xsd:complexType&gt;   
  
     &lt;xsd:element name="mysumResponse" type="xsd:int"/&gt;
    &lt;/xsd:schema&gt;
   &lt;/wsdl:types&gt;
  
   &lt;wsdl:message name="mysumRequest"&gt;
     &lt;wsdl:part name="parameters" element="tns:mysumRequest" /&gt;
   &lt;/wsdl:message&gt; 
   &lt;wsdl:message name="mysumResponse"&gt;
     &lt;wsdl:part name="result" element="tns:mysumResponse" /&gt;
   &lt;/wsdl:message&gt; 
  
  
   &lt;wsdl:portType name="mysum"&gt;
    &lt;wsdl:operation name="mysum"&gt;
     &lt;wsdl:input message="tns:mysumRequest"/&gt;
     &lt;wsdl:output message="tns:mysumResponse"/&gt;
    &lt;/wsdl:operation&gt;
   &lt;/wsdl:portType&gt; 
  
   &lt;wsdl:binding name="mysumSOAP" type="tns:mysum"&gt;
    &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" /&gt;
    &lt;wsdl:operation name="mysum"&gt;
     &lt;soap:operation soapAction="mysum" /&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="mysum"&gt;
    &lt;wsdl:port name="mysumSOAP" binding="tns:mysumSOAP"&gt;
      &lt;soap:address location="http://www.my-uni-
      project.info/joomla/components/com_jv_vm_soa/mysum.php" /&gt;
    &lt;/wsdl:port&gt;
   &lt;/wsdl:service&gt;
  
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>the service:
  <code></p>
  
  <p>function mysum($parameters) {</p>
  
  <p>$result =  $parameters->item[0]->value + $parameters->item[1]->value;
    return $result  ;
   }</p>
  
  <p>ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache 
   $server = new SoapServer("mysum.wsdl"); 
   $server->addFunction("mysum"); 
   $server->handle(); </p>
  
  <p></code></p>
  
  <p>that I can access from a php client:</p>
  
  <p><code>
      $client = new SoapClient("http://www.my-uni-
       project.info/joomla/components/com_jv_vm_soa/mysum.wsdl"); 
      $params = array('n1' => '4', 'n2' => '8');</p>
  
  <pre><code>try { 
    $result = $client-&gt;__soapCall('mysum', array('parameters' =&gt; $params));
  </code></pre>
  
  <p>echo $result; 
      } catch (SoapFault $exception) { 
        echo $exception;<br>
       } 
  </code></p>
  
  <p>I tried to create a C# client so first I created a service reference "mysum", then on the form I added a button and a label and I added the following code for the button</p>
  
  <pre><code> private void button1_Click(object sender, EventArgs e)
      {
          mysum s = new mysum();
          label1.Text = "" + s.mysum(2, 3);                
      }
  </code></pre>
  
  <p>Whe I run it I get this error:</p>
  
  <pre><code>Error 5 The type or namespace name 'mysum' could not be found (are you 
  missing a using directive or an assembly reference?) 
  </code></pre>
  
  <p>The service is online</p>
  
  <p>Thank you in advanced
  John</p>