Bonjour,

Je suis nouveau ici, alors voila j'ai essayer de chercher un peu partout mais ne trouve pas de solution alors me voila

Ne sachant plus trop comment prendre mon probleme je ne sais pas si je poste dans la bonne section ...

J'essaie de monter un webservice local en C# (WCF) et de l'interroger en Perl via le Cpan SOAP::Lite.

Mais impossible d'interroger le webservice en perl voila le code que j'utilise.

Code client Perl:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
#! c:\perl\bin\perl
 
use strict;
use warnings;
use SOAP::Lite +trace => [qw(all)];
#use SOAP::Lite;
 
print my $service = SOAP::Lite -> uri('http://192.168.123.105:4242/TestWcfForPerl/')
  -> proxy('http://192.168.123.105:4242/TestWcfForPerl/')
  -> on_action(sub{sprintf '%sIServiceTest/%s', @_})
  -> HelloWorld()->result;
Contrat :

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
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
 
namespace Contracts
{
    [ServiceContract]
    //[DataContractFormat(Style = OperationFormatStyle.Rpc)]
    public interface IServiceTest
    {
        [OperationContract]
        string HelloWorld();
    }
}
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
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Contracts;
 
namespace Services
{
    public class ServiceTest : IServiceTest
    {
        public string HelloWorld()
        {
            return "Hello world !!";
        }
    }
}
Hebergeur de services :

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
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Contracts;
using Services;
 
namespace Hebergeur
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceHost host = new ServiceHost(typeof(ServiceTest));
            try
            {
                host.Open();
                Console.WriteLine("Service demarre ...");
                Console.ReadLine();
                host.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }
    }
}
Fichier de configuration du serveur :

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
 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MyBasicHttpBinding" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="false" >
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Services.ServiceTest">
        <endpoint address="http://localhost:4242/TestWcfForPerl/" binding="basicHttpBinding"
            bindingConfiguration="MyBasicHttpBinding" contract="Contracts.IServiceTest" />
      </service>
    </services>
  </system.serviceModel>
</configuration>
Coter debug :

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
57
58
59
60
61
62
63
64
65
66
 
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: HelloWorld
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x1c7eaa4)
SOAP::Transport::HTTP::Client::send_receive: POST http://192.168.123.105:4242/Te
stWcfForPerl/ HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 448
Content-Type: text/xml; charset=utf-8
SOAPAction: http://192.168.123.105:4242/TestWcfForPerl/IServiceTest/HelloWorld
 
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.or
g/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encodi
ng/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://sch
emas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/env
elope/"><soap:Body><HelloWorld xmlns="http://192.168.123.105:4242/TestWcfForPerl
/" xsi:nil="true" /></soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x303f79c)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Date: Tue, 17 Feb 2009 22:55:38 GMT
Server: Microsoft-HTTPAPI/1.0
Content-Length: 764
Content-Type: text/xml; charset=utf-8
Client-Date: Tue, 17 Feb 2009 22:55:38 GMT
Client-Peer: 192.168.123.105:4242
Client-Response-Num: 1
 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault
><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:
ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Act
ion 'http://192.168.123.105:4242/TestWcfForPerl/IServiceTest/HelloWorld' cannot
be processed at the receiver, due to a ContractFilter mismatch at the EndpointDi
spatcher. This may be because of either a contract mismatch (mismatched Actions
between sender and receiver) or a binding/security mismatch between the sender a
nd the receiver.  Check that sender and receiver have the same contract and the
same binding (including security requirements, e.g. Message, Transport, None).</
faultstring></s:Fault></s:Body></s:Envelope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
Use of uninitialized value $service in print at C:\bataille\web_service\c#\clien
t\cli_c#.pl line 11.
SOAP::SOM::DESTROY: ()
SOAP::Lite::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
Merci par avance !!