none
strange wcf error RRS feed

  • Question

  • Hi

    Getting the following error The operation could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

    But what is really strange about this above error is that when I test my code on my laptop it works, I get the results from the service call. But when I deploy the code to our production server then I get the above error. Any ideas why the service call would work on my laptop and not on the server.

    Sunday, October 30, 2016 5:10 PM

Answers

  • Hi

    I managed to fix this issue. All I did is delete the asynch methods from the proxy that was created. if you look at the error message it is complaining about the asynch method which I was not using. So I just deleted all of them and it suddenly started working.

    Thanks for all the advise guys.

    Wednesday, November 2, 2016 6:34 AM

All replies

  • Hello Kirk,

    Interesting error and I am not sure why locally it works but on the server it does not.  I did find the following posts though so I would double check your message parameters to see if they are valid:

    https://blogs.msdn.microsoft.com/drnick/2006/11/27/mixing-message-contract-attributes/

    https://msdn.microsoft.com/en-us/library/ms734675(v=vs.110).aspx?f=255&mspperror=-2147217396#Anchor_0


    Cheers, Jeff

    Sunday, October 30, 2016 7:17 PM
  • Hi Kirk,

    Thank Jeff for the solid suggestion. Could you resolve your issue according the suggestion from Jeff? If not, it would be helpful if you could share us your definition of your operation which produces this error.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 31, 2016 2:20 AM
  • Hi

    Thanks for the suggestion. I understand what the error means now. But I'm still confused. This is not my service that I'm calling. Its a third party service. Here is a copy of the operation for the wsdl.

    <wsdl:operation name="HPQMemberValidationOperation">
    <soap:operation soapAction="HPQMemberValidationOperation" style="document"/>
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
    <soap:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>

    The code to call the service works as such. I've created a proxy from the wsdl that was supplied to me by the third party company. The proxy has created all the classes to interact with the service. So I build up the objects to call the service. Then I serialise the object and call the method. The request below is the object that is being serialised. What I'm not understanding is why the service call would work on my laptop but not from my server.

                   var requestXml = Serialize(request);

                    HpqPortTypeClient clientProxy = GetProxy();
                    clientProxy.ClientCredentials.UserName.UserName = DiscoveryUsername;
                    clientProxy.ClientCredentials.UserName.Password = DiscoveryPassword;

                    var response = clientProxy.HPQMemberValidationOperation(request);

                    var responseXml = Serialize(response);

    Monday, October 31, 2016 8:13 AM
  • Hi Kirk,

    Could you check the requestXml in your laptop and server to see whether there is any different? To be honesty, it is difficult to identify the issue with only error message. Based on the error message, it seems it is related with WCF method, but you said it worked under your laptop. From this, I think we need to use Configuring Tracing on server side to check the real exception.

    I would suggest you check the parameters from laptop and server to see whether there is any different. If they are the same, I am afraid you need to connect third party company for help for they are more familiar with their service, and you could debug their service.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 1, 2016 2:05 AM
  • Hi

    I have checked the request on my laptop and on the server and they are exactly the same. I am busy engaging with the 3rd party company now to see if they can assist.

    Tuesday, November 1, 2016 12:11 PM
  • Hi Kirk,

    If you have any updates about your issue, please feel free to let us know.

    In addition, I suggest you test with other wcf methods whose parameter is simple like sting or int value to check whether it is specific to the WCF methods or there is something wrong in WCF Service.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 2, 2016 2:18 AM
  • Hi

    I managed to fix this issue. All I did is delete the asynch methods from the proxy that was created. if you look at the error message it is complaining about the asynch method which I was not using. So I just deleted all of them and it suddenly started working.

    Thanks for all the advise guys.

    Wednesday, November 2, 2016 6:34 AM