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

Windows Communication Foundation .NET Discussion :

consommation (avec WCF) d'un WebService java xfire avec signature par certificat


Sujet :

Windows Communication Foundation .NET

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 2
    Points : 2
    Points
    2
    Par défaut consommation (avec WCF) d'un WebService java xfire avec signature par certificat
    Bonjour à tous,

    A partir d’un programme en C#, je cherche à accéder à un webservice Java / Xfire.

    J’utilise WCF en framework 3.5

    La difficulté, c’est que je dois utiliser un certificat pour signer le message mais pas pour crypter le message ou le transport (SSL).
    Dans la configuraton, si je remplace <security mode="None"> par <security mode="Message">, le message est crypté ce qui n'est pas le but!.

    De quelle façon puis je rajouter la signature seulement ?

    Ci-dessous le fichier de configuration et l’appel au web service.

    D’avance merci.

    Voici le fichier de configuration:

    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
     
    <configuration>
        <system.serviceModel>
          <bindings>
              <wsHttpBinding>
                    <binding name="AppelWSHttpBinding" … messageEncoding="Text" textEncoding="utf-8" 
                        useDefaultWebProxy="true"> 
                        <readerQuotas ()/>
                        <security mode="None">
                          <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                          <message clientCredentialType="None"   />
                        </security> 
                    </binding> 
                </wsHttpBinding>
          </bindings>
          <behaviors>
            <endpointBehaviors>
              <behavior name="NewBehavior">
                <clientCredentials>
                  <clientCertificate storeLocation="CurrentUser" ()/>
                </clientCredentials>
              </behavior>
            </endpointBehaviors>
          </behaviors>
          <client>
              <endpoint address="http://url.ws.adresse/AppelWS"  behaviorConfiguration="NewBehavior" 
    binding="wsHttpBinding" bindingConfiguration="AppelWSHttpBinding" 
                  contract="AppelWSPortType" name="AppelWSHttpPort" >
                  <identity> <dns value="Test"/> </identity>
              </endpoint>
          </client>
        </system.serviceModel>
    </configuration>
    Voici le code de l’appel au Web service:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    ()
    using System.ServiceModel;
    using System.Security.Cryptography.X509Certificates;
    ()
    AppelWSRequest RLPRequest = new AppelWSRequest();
    ()
    System.ServiceModel.ChannelFactory<AppelWSPortType> myChannelFactory = null;
    AppelWSPortType myService;
    myChannelFactory = new System.ServiceModel.ChannelFactory<AppelWSPortType>("AppelWSHttpPort")
    myService = myChannelFactory.CreateChannel();
    () Appel du web service par myService.AppelWS

  2. #2
    Candidat au Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 2
    Points : 2
    Points
    2
    Par défaut Précisions
    j'ai pu obtenir un message type attendu par le web service:
    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
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
     
    <soap:Envelope xmlns:soap="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>
    		<wsse:Security soap:mustUnderstand="1" 
    				xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    			<wsse:BinarySecurityToken 
    				EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" 
    				ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" 
    				wsu:Id="CertId-5555555" 
    				xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    				xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    				MIIE(... 1444 char ...)hv/jeE=
    			</wsse:BinarySecurityToken>
    			<ds:Signature Id="Signature-1111111" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    				<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    					<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" 
    						xmlns:ds="http://www.w3.org/2000/09/xmldsig#" /> 
    					<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1" 
    						xmlns:ds="http://www.w3.org/2000/09/xmldsig#" /> 
    					<ds:Reference URI="#id-7639552" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    						<ds:Transforms xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    						<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" 
    							xmlns:ds="http://www.w3.org/2000/09/xmldsig#" /> 
    						</ds:Transforms> 
    						<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" 
    							xmlns:ds="http://www.w3.org/2000/09/xmldsig#" /> 
    						<ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">VbG(... 28 char ...)AI=</ds:DigestValue>
    					</ds:Reference>
    				</ds:SignedInfo>
    				<ds:SignatureValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    					H8N(... 57 char ...)XQ==
    				</ds:SignatureValue>
    				<ds:KeyInfo Id="KeyId-11111111" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    					<wsse:SecurityTokenReference wsu:Id="STRId-22222222" 
    							xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    							xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    						<wsse:Reference URI="#CertId-3333333" 
    							ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" 
    							xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" />
    					</wsse:SecurityTokenReference> 
    				</ds:KeyInfo> 
    			</ds:Signature>
    		</wsse:Security>
    		<ns3:critere xmlns="http://xxx.net" 
    			xmlns:ns2="http://yyy.net" 
    			xmlns:ns3="http://zzz.net/CallWS">
    			<code1></code1>(...)<codeN></codeN>
    		</ns3:critere>
    	</soap:Header>
    	<soap:Body wsu:Id="id-4444444" 
    		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    		<callWS xmlns="http://zzz.net/CallWS" />
    	</soap:Body>
    </soap:Envelope>
    alors que ce que génére ce programme :
    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
     
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    	<s:Header>
    		<a:Action s:mustUnderstand="1"/>
    		<h:critere xmlns:h="http://zzz.net/CallWS" xmlns="http://zzz.net/CallWS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    			<code1 xsi:nil="true" xmlns="http://xxx.net"/>
    			(...)
    			<codei xmlns="http://xxx.net">12345678</codei>
    			(...)
    			<coden xsi:nil="true" xmlns="http://xxx.net"/>
    		</h:critere>
    		<a:MessageID>urn:uuid:2cf71f78-c25e-4a8c-4795-a1f7f715c789</a:MessageID>
    		<a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo>
    		<a:To s:mustUnderstand="1">http://zzz.net/CallWS/</a:To>
    	</s:Header>
    	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    		<CallWS xmlns="http://zzz.net/CallWS"/>
    	</s:Body>
    </s:Envelope>
    ça me semble assez éloigné!

    Quelqu'un a t il une piste de recherche pour me rapprocher du résultat attendu?

    merci

Discussions similaires

  1. Réponses: 27
    Dernier message: 11/08/2011, 22h12
  2. Consommer un webservice java depuis PHP avec un wsdl
    Par crazymad dans le forum Services Web
    Réponses: 1
    Dernier message: 04/05/2011, 17h29
  3. Appel d'un WebService Delphi avec WCF
    Par Tetranos dans le forum Windows Communication Foundation
    Réponses: 0
    Dernier message: 11/05/2009, 15h08
  4. Consommer un webservice java
    Par Rizzen dans le forum Flex
    Réponses: 7
    Dernier message: 05/08/2008, 15h28

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