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

VB.NET Discussion :

No SOAPAction header / Tag soap:header


Sujet :

VB.NET

  1. #1
    Membre actif
    Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    336
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mars 2010
    Messages : 336
    Points : 227
    Points
    227
    Par défaut No SOAPAction header / Tag soap:header
    Bonjour,

    je souhaite envoyer un message soap. Cependant lors de la réponse je reçoit cette erreur :

    "Le serveur distant a retourné une erreur*: (500) Erreur interne du serveur."

    Le type de contenu text/xml; charset=utf-8 du message de réponse ne correspond pas au type de contenu de la liaison (application/soap+xml; charset=utf-8). Si vous utilisez un encodeur personnalisé, vérifiez que la méthode IsContentTypeSupported est implémentée correctement. Les premiers 562 octets de la réponse étaient : '<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlnssd="http://www.w3.org/2001/XMLSchema" xmlnssi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <soapenv:Fault>
    <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
    <faultstring>no SOAPAction header!</faultstring>
    <detail>
    <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">xxxxxx</ns2:hostname>
    </detail>
    </soapenv:Fault>
    </soapenv:Body>
    </soapenv:Envelope>'.

    Donc j'essaie d'ajouter la balise SOAPAction dans le soap:header mais je ne trouve aucun exemple de tag soap:soapAction
    Savez-vous comment faire ?

    voici le xml de mon soap :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">" & _
                                                                       "<soap:Header>" & _
                                                                       "</soap:Header>" & _
                                                                        "<soapenv:Body>" & _
                                                                        "<xmlString xmlns=""xxxxxxx"">" & _
                                                                       "xxxxxx</xmlString></soapenv:Body></soapenv:Envelope"
    D'avance je vous remercie.

  2. #2
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Bonjour,
    Je suppose que tu utilises un HttpWebRequest pour l'envoi de ton message Soap. Tu peux donc ajouter l'action dans le header ce cette façon :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    webRequest.Headers.Add("SOAPAction", action);

  3. #3
    Membre actif
    Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    336
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mars 2010
    Messages : 336
    Points : 227
    Points
    227
    Par défaut
    Citation Envoyé par ebastien Voir le message
    Bonjour,
    Je suppose que tu utilises un HttpWebRequest pour l'envoi de ton message Soap. Tu peux donc ajouter l'action dans le header ce cette façon :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    webRequest.Headers.Add("SOAPAction", action);
    Bonjour,

    non je construit le xml "à la main". Ensuite, je transmet mon xml à mon webservice.

  4. #4
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Tu définis ton webservice comment ? C'est quoi le moyen de communication entre ton client et ton webservice ? Je pense qu'il faudrait un peu de code pour comprendre...

  5. #5
    Membre actif
    Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    336
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mars 2010
    Messages : 336
    Points : 227
    Points
    227
    Par défaut
    Citation Envoyé par ebastien Voir le message
    Tu définis ton webservice comment ? C'est quoi le moyen de communication entre ton client et ton webservice ? Je pense qu'il faudrait un peu de code pour comprendre...
    Ok voici le code que j'utilise :

    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
     Dim myBinding As WSHttpBinding = New WSHttpBinding
            myBinding.Security.Mode = SecurityMode.Transport
            myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
                 Dim endpointAd As EndpointAddress = New EndpointAddress("https://xxxxx/xxxx/xxxx/xxxx")
     
            Dim xmlRequest As SendXml.xxxxWebServiceConnectorClient = New SendXml.xxxxWebServiceConnectorClient(myBinding, endpointAd)
     
            Dim request As SendXml.requestXML = New SendXml.requestXML("<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">" & _
                                                                       "<soap:Header>" & _
                                                                       "</soap:Header>" & _
                                                                        "<soapenv:Body>" & _
                                                                        "<xmlString xmlns=""xxxxxxx"">" & _
                                                                       "xxxxxx</xmlString></soapenv:Body></soapenv:Envelope")
                  Try
                xmlRequest.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, _
                                                                       System.Security.Cryptography.X509Certificates.StoreName.AuthRoot, _
                                                                       System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, _
                                                                       "xxxxx")
                           ' Begin using the client.
                Dim xmlReply As SendXml.replyXML = xmlRequest.SendXml_xxxxWebServiceConnector_sendXML(request)
            Catch ex As Exception
     
            End Try

  6. #6
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Il est étonnant ton webService. Le webService a une méthode SendXml_xxxxWebServiceConnector_sendXML (déjà le nom...) qui attend un message soap ? Tu est sûr de son utilisation ? Si ce n'est pas indiscret , il sert à quoi ce webservice ?

  7. #7
    Membre actif
    Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    336
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mars 2010
    Messages : 336
    Points : 227
    Points
    227
    Par défaut
    la méthode SendXml_xxxxWebServiceConnector_sendXML peut prendre en paramètre soit l'objet RequestXml comme dans le code ci-dessous soit recevoir le xml en string grace à cet instruction :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     xmlRequest.sendXML(request.xmlString)
    avec la dernière instruction le retour est renvoyé en référence dans request.xmlString

    le webservice ne viens pas de moi mais d'un organisme fédéral pour avoir des informations sur des allocataires sociaux ....
    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
     
     Dim myBinding As WSHttpBinding = New WSHttpBinding
            myBinding.Security.Mode = SecurityMode.Transport
            myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
                 Dim endpointAd As EndpointAddress = New EndpointAddress("https://xxxxx/xxxx/xxxx/xxxx")
     
            Dim xmlRequest As SendXml.xxxxWebServiceConnectorClient = New SendXml.xxxxWebServiceConnectorClient(myBinding, endpointAd)
     
            Dim request As SendXml.requestXML = New SendXml.requestXML("<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">" & _
                                                                       "<soap:Header>" & _
                                                                       "</soap:Header>" & _
                                                                        "<soapenv:Body>" & _
                                                                        "<xmlString xmlns=""xxxxxxx"">" & _
                                                                       "xxxxxx</xmlString></soapenv:Body></soapenv:Envelope")
                  Try
                xmlRequest.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, _
                                                                       System.Security.Cryptography.X509Certificates.StoreName.AuthRoot, _
                                                                       System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, _
                                                                       "xxxxx")
                           ' Begin using the client.
                Dim xmlReply As SendXml.replyXML = xmlRequest.SendXml_xxxxWebServiceConnector_sendXML(request)
            Catch ex As Exception
     
            End Try
    j'ai essayer d'envoyer avec le xml comme ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    "<xmlString xmlns=""xxxxxxx"">" & _
                                                                       "xxxxxx</xmlString>
    mais j'ai toujours ce problème de headers ...

  8. #8
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Juste comme ça par hasard, es-tu sûr que ton objet requestXML attende un XML dans son constructeur et pas tout simplement la string ? De ce fait ce serait lui qui s'occuperait de mettre la string dans un format XML.

  9. #9
    Membre actif
    Profil pro
    Développeur informatique
    Inscrit en
    Mars 2010
    Messages
    336
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mars 2010
    Messages : 336
    Points : 227
    Points
    227
    Par défaut
    Citation Envoyé par ebastien Voir le message
    Juste comme ça par hasard, es-tu sûr que ton objet requestXML attende un XML dans son constructeur et pas tout simplement la string ? De ce fait ce serait lui qui s'occuperait de mettre la string dans un format XML.
    en fait, avec la méthode la plus simple on pourrait faire comme ceci plutot que d'envoyer via l'encapsulation dans l'objet :

    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
     
    Dim myBinding As WSHttpBinding = New WSHttpBinding
            myBinding.Security.Mode = SecurityMode.Transport
            myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
                 Dim endpointAd As EndpointAddress = New EndpointAddress("https://xxxxx/xxxx/xxxx/xxxx")
     
            Dim xmlRequest As SendXml.xxxxWebServiceConnectorClient = New SendXml.xxxxWebServiceConnectorClient(myBinding, endpointAd)
     
    dim monXml as string = "<xmlString xmlns=""xxxxxxx"">" & _
                                      "xxxxxx</xmlString>"
     
    xmlRequest.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, _
                                                                       System.Security.Cryptography.X509Certificates.StoreName.AuthRoot, _
                                                                       System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, _
                                                                       "xxxxx")
    xmlRequest.sendXML(monXML)
    en effet, XmlRequest.sendXML attend le xml sous la forme d'un string. Mais comme j'ai une erreur No SOAPAction je me suis dit je vais ajouté dans ma string les balises soap mais pour le soap:headers je ne trouve pas le tag soapAction.
    C'est pour cela que j'essai de le faire manuellement.

    Mon objet
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Dim xmlRequest As SendXml.xxxxWebServiceConnectorClient = New SendXml.xxxxWebServiceConnectorClient(myBinding, endpointAd)
    est une référence de service que j'ai ajouté à mon projet avec cette adresse : https://xxxx-services-prod.smals.be/...ectorPort?wsdl

  10. #10
    Membre expérimenté
    Homme Profil pro
    Développeur .Net / Delphi
    Inscrit en
    Juillet 2002
    Messages
    738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .Net / Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2002
    Messages : 738
    Points : 1 745
    Points
    1 745
    Par défaut
    Ok je ne parlais pas de ta variable xmlRequest. Déjà ce code me paraît plus sympa.
    Ici, tu n'utilises plus la classe requestXML. Cette classe attend une string dans son constructeur et a une propriété xmlString. Je me disais que cette classe pourrait peut-être encapsuler ta string dans du XML compatible avec ton WebService (sinon à quoi sert-elle ?)

    En reprenant ton code, je tenterais un truc du genre :
    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
     
    Dim myBinding As WSHttpBinding = New WSHttpBinding
    myBinding.Security.Mode = SecurityMode.Transport
    myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate
    Dim endpointAd As EndpointAddress = New EndpointAddress("https://xxxxx/xxxx/xxxx/xxxx")
     
    Dim xmlRequest As SendXml.xxxxWebServiceConnectorClient = New SendXml.xxxxWebServiceConnectorClient(myBinding, endpointAd)
     
    Dim myRequestXML As SendXml.requestXML = New SendXml.requestXML("xxxxx")
     
    xmlRequest.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.CurrentUser, _
                                                                       System.Security.Cryptography.X509Certificates.StoreName.AuthRoot, _
                                                                       System.Security.Cryptography.X509Certificates.X509FindType.FindBySubjectName, _
                                                                       "xxxxx")
    dim reply as SendXml.replyXML =xmlRequest.sendXML(myRequestXML.xmlString)
    Bon je suis peut-être complètement à côté de la plaque, je ne sais pas...

Discussions similaires

  1. SOAP Headers : remove types tag
    Par Dripple dans le forum Services Web
    Réponses: 3
    Dernier message: 16/06/2010, 20h06
  2. [Débutant] Consommation et SOAP Header
    Par sunvialley dans le forum Services Web
    Réponses: 6
    Dernier message: 22/07/2009, 12h02
  3. Soap Header Authentication
    Par theodoric dans le forum Services Web
    Réponses: 1
    Dernier message: 24/04/2009, 23h38
  4. Soap Header dans la réponse
    Par fragmonster dans le forum Services Web
    Réponses: 1
    Dernier message: 15/11/2007, 22h49
  5. [ECLIPSE3.1][WDSL2java] Soap header
    Par cosmos38240 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 11/02/2005, 14h53

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