IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Web service erreur CS0029, CS0030


Sujet :

C#

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2008
    Messages : 9
    Par défaut Web service erreur CS0029, CS0030
    Bonjour,

    J'essaie de tester un webservice avec le code suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    private void _btnTestWS_Click(object sender, RoutedEventArgs e)
            {
                try
                {
                    WebServiceS.SPort70Client _ws;
                    _ws = new WebServiceS.SPort70Client();
                    WebServiceS.authParam ap = new WebServiceS.authParam();
                    ap.login = "testssoap";
                    ap.password = "testssoap";
     
     
                    _ws.Open();
     
                    string sAuth = "";
                    sAuth = _ws.auth(ap);
                    MessageBox.Show(sAuth);
     
                    WebServiceS.contextParam cp = new WebServiceS.contextParam();
                    cp.sessid = sAuth;
     
                    WebServiceS.browseParam bp = new WebServiceS.browseParam();
                    bp.fields = "all";
                    bp.filter = "GC_REFERENCE LIKE 'RL1ML%'";
     
                    WebServiceS.displayResult[] dr;
                    dr = _ws.browse(cp, bp);
     
                    WebServiceS.displayParam dp = new WebServiceS.displayParam();
                    dp.oid = dr[0].oid;
     
                    _ws.display(cp, dp);
                    _ws.Close();
                }
                catch (Exception ee)
                {
                    throw ee;
                }
            }
    Je n'ai pas d'erreur lorsque je génère la solution, mais j'ai une exception lorsque l'instruction "sAuth = _ws.auth(ap);" est exécutée.
    Ci-dessous l'erreur :
    {System.ServiceModel.CommunicationException: Une erreur s'est produite lors de la désérialisation du corps du message authRequest*: 'Impossible de générer une classe temporaire (result=1).
    error CS0030: Impossible de convertir le type 'string[]' en 'string'
    error CS0029: Impossible de convertir implicitement le type 'string' en 'string[]'
    '. Pour plus d'informations, consultez InnerException. ---> System.InvalidOperationException: Impossible de générer une classe temporaire (result=1).
    error CS0030: Impossible de convertir le type 'string[]' en 'string'
    error CS0029: Impossible de convertir implicitement le type 'string' en 'string[]'

    à System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
    à System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
    à System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
    à System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
    à System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()
    à System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle)
    à System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_BodySerializer()
    à System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
    --- Fin de la trace de la pile d'exception interne ---

    Server stack trace:
    à System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
    à System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters, Object returnValue, Boolean isRequest)
    à System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
    à System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
    à System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
    à System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
    à System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
    à System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
    à System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
    à System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message message)
    à System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
    à System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
    à System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
    à System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
    à System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
    à System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
    à System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:
    à B2B_WebServicesMKT.MainWindow._btnTestWS_Click(Object sender, RoutedEventArgs e) dans E:\Dev\B2B_WebServicesMKT\B2B_WebServicesMKT\MainWindow.xaml.cs:ligne 76
    à System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    à System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
    à System.Windows.Controls.Primitives.ButtonBase.OnClick()
    à System.Windows.Controls.Button.OnClick()
    à System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
    à System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
    à System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    à System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    à System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
    à System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
    à System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
    à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
    à System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
    à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
    à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
    à System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
    à System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
    à System.Windows.Input.InputManager.ProcessStagingArea()
    à System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
    à System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
    à System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
    à System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    à System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
    à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
    à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
    à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
    à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
    à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
    à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
    à System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
    à System.Windows.Threading.Dispatcher.Run()
    à System.Windows.Application.RunDispatcher(Object ignore)
    à System.Windows.Application.RunInternal(Window window)
    à System.Windows.Application.Run(Window window)
    à System.Windows.Application.Run()
    à B2B_WebServicesMKT.App.Main() dans E:\Dev\B2B_WebServicesMKT\B2B_WebServicesMKT\obj\x86\Debug\App.g.cs:ligne 0
    à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    à System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
    à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
    à System.Activator.CreateInstance(ActivationContext activationContext)
    à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
    à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    à System.Threading.ThreadHelper.ThreadStart()}
    Est ce que quelqu'un a une idée ?

  2. #2
    Rédacteur/Modérateur


    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    19 875
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2004
    Messages : 19 875
    Par défaut
    On dirait que la définition des méthodes n'est pas la même entre le client et le service... essaie de mettre à jour ta référence de service (clic droit sur la référence)

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2008
    Messages : 9
    Par défaut
    J'ai modifié le fichier reference.cs pour remplacer [][] par [] sur un attribut, du coup l'identification fonctionne mais la fonction me renvoie null au lien de l'id session...

    Une idée ??

  4. #4
    Rédacteur/Modérateur


    Homme Profil pro
    Développeur .NET
    Inscrit en
    Février 2004
    Messages
    19 875
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2004
    Messages : 19 875
    Par défaut
    Citation Envoyé par whitespoon Voir le message
    J'ai modifié le fichier reference.cs pour remplacer [][] par [] sur un attribut, du coup l'identification fonctionne mais la fonction me renvoie null au lien de l'id session...

    Une idée ??
    Non, mais il vaut mieux éviter de modifier à la main les fichiers auto-générés... il vaut mieux mettre à jour automatiquement comme je t'avais dit

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Septembre 2008
    Messages
    9
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Septembre 2008
    Messages : 9
    Par défaut
    J'ai fait la mise à jour et cela ne fonctionne toujours...
    J'ai ait un test en php et tout fonctionne avec le webservice !
    Le problème vient donc bien de l'ajout du webservice au projet... Mais là je cale...

    Any idea ?

  6. #6
    Membre averti
    Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2009
    Messages
    17
    Détails du profil
    Informations personnelles :
    Âge : 65
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2009
    Messages : 17
    Par défaut erreur fichier auto générer
    Bonjour
    j'ai le même problème que toi.
    le fournisseur du web service que je dois intégrer, m'as dit de corriger la classe générer (reference.cs) à la mano, car Visual studio fait un peu n'importe quoi lors de la génération. En fait il créer une classe, mais ne se préoccupe pas du tout de sa validité.
    Alors quand on dit qu'il faut faire une mise à jour du service, oui bien sur, mais cela remet ta classe à l'état initial, et donc inexploitable avec VS et tu perds toutes tes modifs , pour info tout les langages hors Microsoft fonctionnent,
    Bref il faut débugger la classe auto générer, pour que cela fonctionne.
    Super gain de temps, et prier le ciel pour que le fournisseur ne rajoute pas une fonctionnalité.
    Par contre pour notre erreur commune je n'ai toujours pas trouver je vais faire des tests.

Discussions similaires

  1. Appel Web Service, erreur avec string
    Par cricrides dans le forum VB.NET
    Réponses: 0
    Dernier message: 28/07/2010, 15h17
  2. Web Service erreur
    Par Gashgul dans le forum Silverlight
    Réponses: 2
    Dernier message: 26/11/2009, 08h35
  3. Réponses: 4
    Dernier message: 27/05/2009, 11h52
  4. Web Service Erreur 401
    Par Bal1n dans le forum Services Web
    Réponses: 2
    Dernier message: 03/11/2008, 10h46
  5. [SOAP][Web Service] erreur création d'une référence Web
    Par Maximil ian dans le forum XML/XSL et SOAP
    Réponses: 6
    Dernier message: 20/06/2005, 13h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo