System.InvalidOperationException无法识别指定的类型

时间:2013-06-14 22:23:22

标签: c# .net soap soapui

我明白了:

The specified type was not recognized: name='ur-type', namespace='http://www.w3.org/2001/XMLSchema', at <response xmlns=''>.

尝试调用Web服务时。奇怪的是,在使用SoapUI进行测试时,请求正在运行。

我的堆栈跟踪如下所示:

    [InvalidOperationException: The specified type was not recognized: name='ur-type', namespace='http://www.w3.org/2001/XMLSchema', at <response xmlns=''>.]
   System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifiedName typeName, Boolean throwOnUnknown) +1283036
   System.Xml.Serialization.XmlSerializationReader.ReadArray(String typeName, String typeNs) +703
   System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(String name, String ns, Boolean elementCanBeType, String& fixupReference) +494
   Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReadergarage_portClient.Read9_getCarsResponse() +809
   Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer3.Deserialize(XmlSerializationReader reader) +43
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +579

[InvalidOperationException: There is an error in XML document (2, 490).]
   System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +1377
   System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest) +763

[CommunicationException: Error in deserializing body of reply message for operation 'getCars'.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +4729427
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +1725
   Cms.CarsGarage.garage_portClient.getCars(getCarsRequest request) +0
   Cms.CarsGarage.garage_portClient.Cms.CarsGarage.garage_portClient.getCars(getCarsRequest request) in D:\Projects\MyProject\trunk\Cms\Service References\CarsGarage\Reference.cs:595
   Cms.CarsGarage.garage_portClient.getCars(String brand, brandstof fuel) in D:\Projects\MyProject\trunk\Cms\Service References\CarsGarage\Reference.cs:602
   Cms.Widgets.CarGarage.CarGarageWidget.BringMeTheCars() in D:\Projects\MyProject\trunk\Cms\Widgets\CarGarage\CarGarageWidget.ascx.cs:437
   Cms.Widgets.CarGarage.CarGarageWidget.submitButton_Click(Object sender, EventArgs e) in D:\Projects\MyProject\trunk\Cms\Widgets\CarGarage\CarGarageWidget.ascx.cs:330
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

这个错误的原因是什么?

更新:

//Calling code

garage_portClient proxy = new garage_portClient();
cars = proxy.getCars(CarBrand.SelectedValue, FuelType.SelectedValue);


[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="getCars", WrapperNamespace="", IsWrapped=true)]
public partial class getCarsRequest {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
    public string brand;

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
    public Cms.Garage.brandstof fuel;

    public getCarsRequest() {
    }

    public getCarsRequest(string brand, Cms.Garage.fueltype fuel) {
        this.brand = brand;
        this.fuel = fuel;
    }
}



[System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(WrapperName="getCarsResponse", WrapperNamespace="", IsWrapped=true)]
    public partial class getCarsResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
        public object[] response;

        public getCarsResponse() {
        }

        public getCarsResponse(object[] response) {
            this.response = response;
        }
    }

0 个答案:

没有答案
相关问题