I'm having troubles to consume a php web service (which I can't modify) in my asp.net web api project. I tried to use "Add service reference" and "Add web reference", but still it's not working. I'm trying to find a solution that explain me how to edit or reconstruct the wsdl file (which I saved locally) so I can use it to consume the services. I've found another similar threads but without a solution that can help me. My problem is very similar to this one with .NET 2.0 but I'm using .NET 4.5:
Here is my errors message:
The document at the url file:xxx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'The root element of a W3C XML Schema should be <schema> and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'.
- Report from 'DISCO Document' is 'Discovery document at the URL file:xxx could not be found.'.
- The document format is not recognized.
- Report from 'WSDL Document' is 'There is an error in XML document (29, 6).'.
- The element was not expected in this context: <xsd:element xmlns:xsd='http://www.w3.org/2001/XMLSchema'>..</xsd:element>. Expected elements: http://www.w3.org/2001/XMLSchema:annotation, http://www.w3.org/2001/XMLSchema:choice, http://www.w3.org/2001/XMLSchema:group, http://www.w3.org/2001/XMLSchema:all, http://www.w3.org/2001/XMLSchema:sequence, http://www.w3.org/2001/XMLSchema:attributeGroup, http://www.w3.org/2001/XMLSchema:attribute, http://www.w3.org/2001/XMLSchema:anyAttribute.
The lines 28 to 30 are:
<xsd:element name="WSData" type="tns:WSData" datos="WSData"/>
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:WSData[]"/>
</xsd:restriction>
Here is my entire wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php">
<wsdl:types>
<xsd:schema targetNamespace="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="WSDataIN">
<xsd:all>
<xsd:element name="user" type="xsd:string" datos="user"/>
<xsd:element name="password" type="xsd:string" datos="password"/>
<xsd:element name="message" type="xsd:string" datos="message"/>
<xsd:element name="datetime" type="xsd:string" datos="datetime"/>
<xsd:element name="messageid" type="xsd:string" datos="messageid"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="WSData">
<xsd:all>
<xsd:element name="codigores" type="xsd:string" datos="codigores"/>
<xsd:element name="descrres" type="xsd:string" datos="descrres"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="WSDataArray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:element name="WSData" type="tns:WSData" datos="WSData"/>
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:WSData[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="EnviaSMSRequest">
<part name="datos" type="tns:WSDataIN" /> <wsdl:/message>
<wsdl:message name="EnviaSMSResponse">
<part name="return" type="tns:WSData" /> <wsdl:/message>
<wsdl:portType name="WSEnvioSMSPortType">
<operation name="EnviaSMS">
<documentation>Envia SMS a clientes </documentation>
<input message="tns:EnviaSMSRequest"/>
<output message="tns:EnviaSMSResponse"/>
</operation>
</wsdl:portType>
<wsdl:binding name="WSEnvioSMSBinding" type="tns:WSEnvioSMSPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="EnviaSMS">
<soap:operation soapAction="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php?wsdl#EnviaSMS" style="rpc"/>
<input> <soap:body use="encoded" namespace="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php?wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input>
<output> <soap:body use="encoded" namespace="https://oneurl.tv/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php?wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output>
</operation>
</wsdl:binding>
<wsdl:service name="WSEnvioSMS">
<port name="WSEnvioSMSPort" binding="tns:WSEnvioSMSBinding">
<soap:address location="https://oneurl.tv:443/urlexists/1045_APPmobileApp/wsdl/WSDLEnvio.php"/>
</port>
</wsdl:service>
</wsdl:definitions>
Thank you so much, I appreciate any suggestion.