简体   繁体   中英

WCF Action attribute.change results in Client being unable to see function when service reference is updated

I am writing a WCF service to receive data from a client. We have no control over the client, in-fact I don't think our customer has the source. A previous developer has a note that the OperationContract[Action = ..] attribute must be specified.

I am also creating a test client to send some mock data to check that I process the data correctly. I use the base address ( http://localhost:9000/SKUChange/ ) listed from the app.config of my service to add a service reference to the test client.

      <services>
        <service name="ME_BAT_ClassLib.MessageReceiverService">
            <endpoint address="" binding="basicHttpBinding" contract="TNTLS_MessageProcessorSoap">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:9000/SKUChange/" />
                </baseAddresses>
            </host>
        </service>
    </services>

If I leave the [OperationContract] with default attributes.

    [OperationContract]
    string ProductInformationMessage(string parTNTProductInformation);

When I update the service reference within my test client I can see my function ProductInformationMessage.

默认属性

If however I change the [OperationContract] Action attribute to the value required in the notes my test service ( [OperationContract(Action = "http://localhost/webservices/ProductInformationMessage", ReplyAction = "*")] ) no longer see the function.

指定了动作属性

I have tried altering the address when going to "Add service Reference to no luck. I am sure I a missing something very obverse!

Many Thanks

Your ReplyAction should not be '*' or wcf will not publish metadata about the operation. Normally, the replyAction should be Action + "Response", so please change it to http://localhost/webservices/ProductInformationMessageResponse , then you should see the method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM