2010-11-18 14 views
13

Tengo un servicio web simple que se ejecuta en Visual Studio. Si intento ver los metadatos, falta información sobre la operación y, por lo tanto, svcutil genera el código del cliente sin ningún método. ¿Hay algún problema con mi configuración?Metadata WCF que falta operaciones

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="FCRPublishSOAP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
        <message clientCredentialType="UserName" algorithmSuite="Default"/> 
       </security> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <services> 
     <service name="Test.Publish.FCRPublish" behaviorConfiguration="SimpleServiceBehavior"> 
      <endpoint address="FCRPublish" behaviorConfiguration="" binding="basicHttpBinding" bindingConfiguration="FCRPublishSOAP" contract="IFCRPublish"/> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
    </services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="SimpleServiceBehavior"> 
     <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

Interfaz:

[System.ServiceModel.ServiceContractAttribute(Namespace="http://Test/Publish", ConfigurationName="IFCRPublish")] 
public interface IFCRPublish 
{ 

    // CODEGEN: Generating message contract since the operation PublishNotification is neither RPC nor document wrapped. 
    [System.ServiceModel.OperationContractAttribute(Action="http://Test/PublishNotification", ReplyAction="*")] 
    PublishNotificationResponse1 PublishNotification(PublishNotificationRequest1 request); 
} 

Respuesta:

[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] 
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)] 
public partial class PublishNotificationResponse1 
{ 

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://Test/PublishTypes", Order=0)] 
    public PublishNotificationResponse PublishNotificationResponse; 

    public PublishNotificationResponse1() 
    { 
    } 

    public PublishNotificationResponse1(PublishNotificationResponse PublishNotificationResponse) 
    { 
     this.PublishNotificationResponse = PublishNotificationResponse; 
    } 
} 

Solicitud:

[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] 
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)] 
public partial class PublishNotificationRequest1 
{ 

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://Test/PublishTypes", Order=0)] 
    public PublishNotification PublishNotification; 

    public PublishNotificationRequest1() 
    { 
    } 

    public PublishNotificationRequest1(PublishNotification PublishNotification) 
    { 
     this.PublishNotification = PublishNotification; 
    } 
} 

Estos son los metadatos que recibo:

<wsdl:import namespace="http://Test/Publish" location="http://localhost:3992/FCRPublish.svc?wsdl=wsdl0"/> 
<wsdl:types/> 
<wsdl:binding name="BasicHttpBinding_IFCRPublish" type="i0:IFCRPublish"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> 
</wsdl:binding> 
<wsdl:service name="FCRPublish"> 
    <wsdl:port name="BasicHttpBinding_IFCRPublish" binding="tns:BasicHttpBinding_IFCRPublish"> 
     <soap:address location="http://localhost:3992/FCRPublish.svc"/> 
    </wsdl:port> 
</wsdl:service> 

¿Dónde se ha ido mi operación?

+0

¿'PublishNotificationResponse1' tiene un atributo' DataContract'? –

+0

No, pero tiene un atributo MessageContract. Editaré la publicación para incluir los objetos de solicitud y respuesta. – haymansfield

Respuesta

30

trabajado a cabo. Configurar ReplyAction = "*" para un OperationContract significa que el WsdlExporter (que publica los metadatos) ignorará esa Operación. Establecer cualquier otro valor lo corrige.

Lo que me molesta de esto es que svcutil establecerá responseaction por defecto * lo que significa que svcutil crea servicios para los cuales los metadatos se rompen de manera predeterminada.

+0

Un gran trabajo para encontrar esto. Gracias una tonelada. También estoy trabajando con WCSF Blue Tool para la creación de clientes. – Lijo

+0

Acabo de encontrarme con esto también ... tiene que haber una razón por la cual, esto acaba de desperdiciar una tarde para mí. – Jammer

0

Trate de no incluir FCRPublish de la dirección de su Enpoint ... su punto final Mex está ahí y parece que está bien, por lo que creo que debería funcionar

+0

Intenté esto sin suerte. – haymansfield

+0

echando un vistazo más de cerca a su código, nunca agregué un 'MessageBodyMemberAttribute' sin un' MessageHeaderAttribute', ¿podría agregar uno por si acaso? – sebagomez

Cuestiones relacionadas