Why i'm having this on wsdl?

Viewed 61

i'm just learning to do a WSDL webservice in PHP so im using an example i found on internet as a guide but it doesn't seem to work, it's returning this error:

SOAP-ERROR: Parsing WSDL: No address associated with <port>

This is the WSDL:

<definitions name="AritmeticaServicio" 
    targetNamespace="urn:Aritmetica"
     xmlns:tns="urn:Aritmetica"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
     xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns="http://schemas.xmlsoap.org/wsdl/">

  <message name="AritmeticaPeticion">
    <part name="operando1" type="xsd:float" />
    <part name="operando2" type="xsd:float" />
  </message>

  <message name="AritmeticaRespuesta">
    <part name="respuesta" type="xsd:float" />
  </message>

  <portType name="AritmeticaPort">
    <operation name="sumar">
      <input message="tns:AritmeticaPeticion" />
      <output message="tns:AritmeticaRespuesta" />
    </operation>
    <operation name="restar">
      <input message="tns:AritmeticaPeticion" />
      <output message="tns:AritmeticaRespuesta" />
    </operation>
  </portType>

  <binding name="AritmeticaBinding" type="tns:AritmeticaPort">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="sumar">
        <soap:operation soapAction="urn:Aritmetica#sumar" />
        <input>
          <soap:body use="encoded" namespace="urn:Aritmetica"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
        </input>
        <output>
          <soap:body use="encoded" namespace="urn:Aritmetica"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
        </output>
    </operation>
    <operation name="restar">
        <soap:operation soapAction="urn:Aritmetica#restar" />
        <input>
          <soap:body use="encoded" namespace="urn:Aritmetica"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />       
        </input>
        <output>
          <soap:body use="encoded" namespace="urn:Aritmetica"
                     encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />       
        </output>
    </operation>
  </binding>

  <service name="AritmeticaServicio">
    <port name="AritmeticaPort" binding="tns:AritmeticaBinding">
      <soap:address location="http://127.0.0.1/WSCemex/index.php" />
    </port>
  </service>
</definitions>

this is my index.php:

if(!extension_loaded("soap")){
      dl("php_soap.dll");
}

ini_set("soap.wsdl_cache_enabled","0");
$server = new SoapServer("aritmetica.wsdl");

function sumar($operando1,$operando2){
      return $operando1+$operando2;
}

function restar($operando1,$operando2){
      return $operando1-$operando2;
}

$server->AddFunction("sumar");
$server->AddFunction("restar");
$server->handle();

and this is what i get on http://127.0.0.1/WSCemex/index.php:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<link type="text/css" id="dark-mode" rel="stylesheet" href=""/>
<style type="text/css" id="dark-mode-custom-style"/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>SOAP-ERROR: Parsing WSDL: No address associated with <port></faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

right now im using it in localhost windows with xampp to test it, hope you can help me

0 Answers
Related