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

Développement Web avec .NET Discussion :

WCF using HTTP (TransportCredentialOnly mode: Basic clear text credentials over unsecured transport)


Sujet :

Développement Web avec .NET

  1. #1
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut WCF using HTTP (TransportCredentialOnly mode: Basic clear text credentials over unsecured transport)
    Bonjour tout le monde,

    Jai un WebService qui a été fait sur PeopleSoft, je voudrai l'uliser avec Visual Basic Studio 10.
    A sachant que je dois remplir la partie header pour l'authentification, j'ai utiliser WCF en suivant cette exemple: http://msdn.microsoft.com/fr-fr/library/ms733133.aspx
    En sachant que l'envoi des donnés au WebService se fait de manière crypter; j'ai modifier la partie
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
            public override string Scheme
            {
                //get { return "https"; }
                get { return "http"; }
            }
    et aussi la partie
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
                    case WseSecurityAssertion.UsernameOverTransport:
                        //transport = new HttpsTransportBindingElement();
                        transport = new HttpTransportBindingElement();
                        securityBinding = (TransportSecurityBindingElement)SecurityBindingElement.CreateUserNameOverTransportBindingElement();
    Maintenant pour utiliser le WebService j'ai fait
    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
    39
    40
    41
    42
     // WebService - WCF
                EndpointAddress address = new EndpointAddress(new Uri("http://crmtst:8080/PSIGW/PeopleSoftServiceListeningConnector/OPPORTUNITY_MX.1.wsdl"));
                WseHttpBinding binding = new WseHttpBinding(); // This is the custom binding I created per the MS KB article
     
     
                binding.SecurityAssertion = WseSecurityAssertion.UsernameOverTransport;
                binding.EstablishSecurityContext = false;
     
                // Not sure about the value of either of these next two
                binding.RequireDerivedKeys = true;
                binding.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt;
     
                //MembershipServiceSoapClient proxy = new MembershipServiceSoapClient(binding, address);
                CRM_Sales_Outlook_2010.opportunity_wcf.OPPORTUNITY_MX_PortTypeClient mx_wcf = new CRM_Sales_Outlook_2010.opportunity_wcf.OPPORTUNITY_MX_PortTypeClient(binding, address);
     
                // This is where I believe the problem lies – I can’t seem to properly setup the security credentials the web service is expecting             
                mx_wcf.ClientCredentials.UserName.UserName = "GMENNESSIER";
                mx_wcf.ClientCredentials.UserName.Password = "GMENNESSIER";
                // How do I supply the CN number?                      
     
                MyObject mo = mx_wcf.MyMethod(); // this throws the exception
     
                CRM_Sales_Outlook_2010.opportunity_wcf.ADDOPPNOTE_REQ_MXTypeShape addoppnote = new CRM_Sales_Outlook_2010.opportunity_wcf.ADDOPPNOTE_REQ_MXTypeShape();
     
                CRM_Sales_Outlook_2010.opportunity_wcf.ReqParam_TypeShape reqparam = new CRM_Sales_Outlook_2010.opportunity_wcf.ReqParam_TypeShape();
                //Id OPP
                CRM_Sales_Outlook_2010.opportunity_wcf.OppId_TypeShape oppid = new CRM_Sales_Outlook_2010.opportunity_wcf.OppId_TypeShape();
                oppid.Value = OPP;
                //Message file MSG
                CRM_Sales_Outlook_2010.opportunity_wcf.FileName_TypeShape filename = new CRM_Sales_Outlook_2010.opportunity_wcf.FileName_TypeShape();
                filename.Value = namefile;
                //Titre of message 
                CRM_Sales_Outlook_2010.opportunity_wcf.NoteTitle_TypeShape notetitle = new CRM_Sales_Outlook_2010.opportunity_wcf.NoteTitle_TypeShape();
                notetitle.Value = title;
                //Description of message
                CRM_Sales_Outlook_2010.opportunity_wcf.NoteDescription_TypeShape notedescription = new CRM_Sales_Outlook_2010.opportunity_wcf.NoteDescription_TypeShape();
                notedescription.Value = description;
                reqparam.OppId = oppid;
                reqparam.FileName = filename;
                reqparam.NoteTitle = notetitle;
                reqparam.NoteDescription = notedescription;
                addoppnote.ReqParam = reqparam;
    mais après exécution j'ai cette erreur en exception:
    contract is configured with an authentication mode that requires transport level integrity and confidentiality. However the transport cannot provide integrity and confidentiality.
    Si quelqu'un a une idée sur ce problème il est le bien venu

    Merci

  2. #2
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Il n'y a pas de cryptage en http. D'ou l'erreur. Tu dois passer en https.
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  3. #3
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut
    Oui je suis d'accord, mais je ne veux pas les envoyer en mode crypté, je veux les envoyer en claire, parceque le webservice qu'on a ne peut pas les décrypter.
    Je veux savoir comment je peux utiliser "http"

  4. #4
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut
    Voila j'ai fait quelque modification pour l'utilisation du websercive
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    EndpointAddress address = new EndpointAddress(new Uri("http://crmtst:8080/PSIGW/PeopleSoftServiceListeningConnector/OPPORTUNITY_MX.1.wsdl"));
                BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
                binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
                CRM_Sales_Outlook_2010.opportunity_wcf.OPPORTUNITY_MX_PortTypeClient mx_wcf = new CRM_Sales_Outlook_2010.opportunity_wcf.OPPORTUNITY_MX_PortTypeClient(binding, address);
                mx_wcf.ClientCredentials.UserName.UserName = "GMENNESSIER";
                mx_wcf.ClientCredentials.UserName.Password = "GMENNESSIER";
    ......
    maintenant il envoi les données mais sans l'identification aux Webservice et récupère la réponse du Webservice.

    Si vous avez une suggestion pour que l’identification puisse être envoyer en claire au Soapheader.

  5. #5
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Et en utilisant HttpClientCredentialType.Basic comme credentialtype?
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  6. #6
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut
    Oui je l'ai essayé aussi.
    HttpClientCredentialType.Windows est utilisé quand le serveur est dans le même domaine que l'application.
    Voici le format d'envoi que je dois faire.

    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
     
     
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:add="http://crmdev:8080/Enterprise/Tools/schemas/ADDOPPNOTE_REQ_MX.V1">
      <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
        <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <wsse:UsernameToken>
            <wsse:Username>GMENNESSIER</wsse:Username>
            <wsse:Password>GMENNESSIER</wsse:Password>
          </wsse:UsernameToken>
        </wsse:Security>
      </soapenv:Header>
       <soapenv:Body>
          <ADDOPPNOTE_REQ_MX>
             <ReqParam>
                <OppId>OPP2092</OppId>
                <FileName>OPP2092test.tst</FileName>
                <NoteTitle>Test note GMR</NoteTitle>
                <NoteDescription>Test note description</NoteDescription>
             </ReqParam>
          </ADDOPPNOTE_REQ_MX>
       </soapenv:Body>
    </soapenv:Envelope>
    Et actuellement, j'ai que cette partie:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
     
    <?xml version="1.0"?>
    <ADDOPPNOTE_REQ_MX xmlns="http://crmtst:8080/Enterprise/Tools/schemas/ADDOPPNOTE_REQ_MX.V1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <ReqParam>
    <OppId>OPP2171</OppId>
    <FileName>OPP2171_userappsrv_HEITZLER_Gabriel.msg</FileName>
    <NoteTitle>RE__Lenteurs_mxintra___serveur___100__CPU</NoteTitle>
    <NoteDescription>Ko:194560-Date:2/28/2012 2:21:20 PM</NoteDescription>
    </ReqParam>
    </ADDOPPNOTE_REQ_MX>
    donc il me manque bien la partie Header qui est:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <wsse:UsernameToken>
            <wsse:Username>GMENNESSIER</wsse:Username>
            <wsse:Password>GMENNESSIER</wsse:Password>
          </wsse:UsernameToken>
        </wsse:Security>

  7. #7
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Je me demande si il ne faudrait pas se résigner à passer par un messageinspector par exemple, pour injecter le bon header soap
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

  8. #8
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut
    Justement en parlant du Message Inspector, j'ai regardé ce lien pour construire mon propre message Soap pour parametrer le header et le body mais j'ai pas reussi

  9. #9
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2011
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2011
    Messages : 76
    Points : 81
    Points
    81
    Par défaut
    J'ai trouvé un excellent qui va beacoup m'aider sur les messages Inspector
    http://code.msdn.microsoft.com/windo...ector-c4b6790b

  10. #10
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Il y a un gars qui a fait quelque chose de similaire, je ne sais pas si ça peut t'aider :
    http://blog.benpowell.co.uk/2010/11/...-password.html
    Microsoft MVP : Windows Platform

    MCPD - Windows Phone Developer
    MCPD - Windows Developer 4

    http://www.guruumeditation.net

    “If debugging is the process of removing bugs, then programming must be the process of putting them in.”
    (Edsger W. Dijkstra)

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [ZF 1.10] Zend_Auth_Adapter_Http test en mode basic
    Par oxomichael dans le forum Zend_Acl & Zend_Auth
    Réponses: 2
    Dernier message: 23/04/2012, 14h16
  2. Service WCF et HTTPS
    Par GCSX_ dans le forum Services Web
    Réponses: 1
    Dernier message: 11/03/2012, 01h20
  3. [CXF & Proxy] authentification au proxy en mode Basic
    Par zaewonyx dans le forum Services Web
    Réponses: 3
    Dernier message: 23/11/2011, 18h21
  4. Modifier le header d'une requête HTTP en mode 200
    Par Alteo147 dans le forum Servlets/JSP
    Réponses: 7
    Dernier message: 02/02/2011, 10h49
  5. WCF: Authentification HTTP Basic ?
    Par dauphinus dans le forum Windows Communication Foundation
    Réponses: 3
    Dernier message: 27/03/2008, 16h40

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