2012-09-05 2 views
0

ok,Impossible d'appeler le service WCF Opération

Je mis en place un service et il génère un fichier WSDL, mais je reçois un 404 en essayant d'y accéder.

http://localhost:51902/TestService/DoWork 

mon wsdl:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="TestService" targetNamespace="http://tempuri.org/"> 
<wsdl:types> 
<xsd:schema targetNamespace="http://tempuri.org/Imports"> 
<xsd:import schemaLocation="http://localhost:51902/TestService.svc?xsd=xsd0" namespace="http://tempuri.org/"/> 
<xsd:import schemaLocation="http://localhost:51902/TestService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/> 
</xsd:schema> 
</wsdl:types> 
<wsdl:message name="TestService_DoWork_InputMessage"> 
<wsdl:part name="parameters" element="tns:DoWork"/> 
</wsdl:message> 
<wsdl:message name="TestService_DoWork_OutputMessage"> 
<wsdl:part name="parameters" element="tns:DoWorkResponse"/> 
</wsdl:message> 
<wsdl:message name="TestService_SayHello_InputMessage"> 
<wsdl:part name="parameters" element="tns:SayHello"/> 
</wsdl:message> 
<wsdl:message name="TestService_SayHello_OutputMessage"> 
<wsdl:part name="parameters" element="tns:SayHelloResponse"/> 
</wsdl:message> 
<wsdl:portType name="TestService"> 
<wsdl:operation name="DoWork"> 
<wsdl:input wsaw:Action="http://tempuri.org/TestService/DoWork" message="tns:TestService_DoWork_InputMessage"/> 
<wsdl:output wsaw:Action="http://tempuri.org/TestService/DoWorkResponse" message="tns:TestService_DoWork_OutputMessage"/> 
</wsdl:operation> 
<wsdl:operation name="SayHello"> 
<wsdl:input wsaw:Action="http://tempuri.org/TestService/SayHello" message="tns:TestService_SayHello_InputMessage"/> 
<wsdl:output wsaw:Action="http://tempuri.org/TestService/SayHelloResponse" message="tns:TestService_SayHello_OutputMessage"/> 
</wsdl:operation> 
</wsdl:portType> 
<wsdl:service name="TestService"/> 
</wsdl:definitions> 

code:

/// <summary> 
    /// This is a very basic service 
    /// </summary> 
    [ServiceContract] 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
    public class TestService 
    { 
     [OperationContract] 
     [WebGet(ResponseFormat = WebMessageFormat.Json)] 
     public void DoWork() 
     { 
      return; 
     } 

     [OperationContract] 
     [WebGet(ResponseFormat = WebMessageFormat.Json)] 
     public string SayHello() 
     { 
      return "Hello"; 
     } 
    } 

Répondre

0

Nevermind ce fait l'affaire:

http://localhost:51902/TestService.svc/DoWork 
+0

vous pourriez peut-être répondre à ma question autre .. même sujet , mais la mise en œuvre légèrement différente! http://stackoverflow.com/questions/12291366/how-do-i-call-this-web-service – KevinDeus

Questions connexes