none
Problem in return value of a wcf method in string or int type RRS feed

  • Question

  • hi, 

    So far, my methods which return Composite Types work well. however, I have a method which returns an int or string. a stored procedure is being called within the web method. the stored procedure returns the proper value when running in sql server management studio but when it is called through WCF it returns a wrong value. is there any rule I should consider when calling a stored procedure which returns a unique value within a wcf method returning a simple type value?

    Thanks.

    Monday, April 18, 2016 10:08 AM

Answers

  • Hello Simin,

    Good that the composite types are working.  Are you returning the result of the stored proc directly or are you mapping to a contract first.  In other words, is the error on the server or on the client?  

    If it is the contract that does not match the return type being sent then it could be the contracts are out of sync between the client and server.

    It could also be that the return type is an int but the sql is returning null in some cases.  Changing it to a int?  might solve it.  

    I suggest posting the exception here and that will provide a lot of detail.

    Cheers


    Jeff

    Tuesday, April 19, 2016 12:27 AM