Jag försöker konsumera en web service från en tredje part. När jag gör det spottar .NET ut följande undantag:The specified type was not recognized: name='string'
The specified type was not recognized: name='string', namespace='http://schemas.xmlsoap.org/soap/encoding/', at <getScheduleForCoursesReturn xmlns=''>
Så här ser WSDL-kontraktet ut:<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:GetScheduleForCourses" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:GetScheduleForCourses" xmlns:intf="urn:GetScheduleForCourses" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
<wsdl:types>
<schema targetNamespace="urn:GetScheduleForCourses" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_soapenc_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<complexType name="ArrayOfArrayOf_soapenc_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[][]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getScheduleForCoursesRequest">
<wsdl:part name="in0" type="impl:ArrayOf_soapenc_string"/>
<wsdl:part name="in1" type="impl:ArrayOf_soapenc_string"/>
</wsdl:message>
<wsdl:message name="getScheduleForCoursesResponse">
<wsdl:part name="getScheduleForCoursesReturn" type="impl:ArrayOfArrayOf_soapenc_string"/>
</wsdl:message>
<wsdl:portType name="GetScheduleForCourses">
<wsdl:operation name="getScheduleForCourses" parameterOrder="in0 in1">
<wsdl:input message="impl:getScheduleForCoursesRequest" name="getScheduleForCoursesRequest"/>
<wsdl:output message="impl:getScheduleForCoursesResponse" name="getScheduleForCoursesResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="getscheduleforcoursesSoapBinding" type="impl:GetScheduleForCourses">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getScheduleForCourses">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getScheduleForCoursesRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:GetScheduleForCourses" use="encoded"/>
</wsdl:input>
<wsdl:output name="getScheduleForCoursesResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:GetScheduleForCourses" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GetScheduleForCoursesService">
<wsdl:port binding="impl:getscheduleforcoursesSoapBinding" name="getscheduleforcourses">
<wsdlsoap:address location="http://I_REMOVED_THIS_URL/getscheduleforcourses"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Jag misstänkter att roten till problemet är "xsd:string[][]". Om man tittar på proxyklassen som skapas av "Add web reference"-wizarden, så hittar man:[System.Web.Services.Protocols.SoapRpcMethodAttribute("",RequestNamespace="urn:GetScheduleForCourses",ResponseNamespace="urn:GetScheduleForCourses")]
[return: System.Xml.Serialization.SoapElementAttribute("getScheduleForCoursesReturn")]
public string[] getScheduleForCourses(string[] in0, string[] in1) {
object[] results = this.Invoke("getScheduleForCourses", new object[] {
in0,
in1});
return ((string[])(results[0]));
}
Jag är långt ifrån någon expert på web services eller XML, men om kontrakter säger att metoden skall returnera string[][], borde inte metoden i proxyklassen göra det också?
Jag skulle uppskatta all hjälp jag kan få.
MVH
Rickard