从Silverlight 5应用程序中使用soap webservice时出错

时间:2016-01-13 07:27:09

标签: c# soap salesforce silverlight-5.0 soap-serialization

我正在使用Silverlight 5应用程序中的salesforce合作伙伴wsdl。当我尝试使用loginAsync方法登录时。我得到例外 -

  

序列化邮件正文时出错:   ' IsNotAssignableFrom'

用于调用服务的代码为 -

    public Boolean Login(String userName, String password, String token)
    {
        SoapClient soapClient = new SoapClient();
        soapClient.loginCompleted += new EventHandler<loginCompletedEventArgs>(Salesforce_LoginCompleted);
        soapClient.loginAsync(userName, password + token);
        return true;
    }


    public void Salesforce_LoginCompleted(Object sender, EventArgs args)
    {
       // login completed code
    }

错误堆栈跟踪为 -

at System.Xml.Serialization.CodeGenerator.InternalConvert(Type source, Type target, Boolean isAddress)
   at System.Xml.Serialization.CodeGenerator.ConvertValue(Type source, Type target)
   at System.Xml.Serialization.SourceInfo.InternalLoad(Type elementType, Boolean asAddress)
   at System.Xml.Serialization.SourceInfo.Load(Type elementType)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElement(SourceInfo source, ElementAccessor element, String arrayName, Boolean writeAccessor)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElements(SourceInfo source, String enumSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, String arrayName, Boolean writeAccessors, Boolean isNullable)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteArrayItems(ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc arrayTypeDesc, String arrayName, String choiceName)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElement(SourceInfo source, ElementAccessor element, String arrayName, Boolean writeAccessor)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElements(SourceInfo source, String enumSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, String arrayName, Boolean writeAccessors, Boolean isNullable)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteMember(SourceInfo source, String choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc memberTypeDesc, Boolean writeAccessors)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteStructMethod(StructMapping mapping)
   at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateMethod(TypeMapping mapping)
   at System.Xml.Serialization.XmlSerializationILGen.GenerateReferencedMethods()
   at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateEnd()
   at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Object evidence)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Object evidence)
   at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
   at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.CreateSerializersFromMappings(XmlMapping[] mappings, Type type)
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle)
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerStub.GetSerializer()
   at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_BodySerializer()
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)

如何解决此问题?

感谢。

0 个答案:

没有答案