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:
1 2 3 4 5
| public override string Scheme
{
//get { return "https"; }
get { return "http"; }
} |
et aussi la partie
Code:
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:
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 cant 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:
Citation:
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