Forum Discussion

seesharpdev's avatar
seesharpdev
New Contributor
11 years ago

JSON Post is null

Hi there.

I am in the process of creating functional test for a REST WebApi with SoapUI 4.6 and struggling to make my Test Cases work as expected.

I can create methods for resources and post Json to my REST WebAPI and i can see that the JSON posted is valid but whenever I add a method to a Test Case the JSON posted is null when it arrives the WebAPI method and I cannot understand why this happens.

Does any one have experienced this behavior?

Thanks in advance

5 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Have not seen this.

    Are you using HTTPS or any other web service security?

    Also, is the Raw request tab the same for default request and REST test step?

    Thanks,
    Michael Giller
    SmartBear Software
  • SmartBear Support wrote:
    Have not seen this.

    Are you using HTTPS or any other web service security?

    Also, is the Raw request tab the same for default request and REST test step?

    Thanks,
    Michael Giller
    SmartBear Software


    Hello Michael,

    Thanks for your assistance.

    In the Http (ASP.NET Web) API side we are using DotNetOpenAuth for authorization, based on a token sent in the Http headers which is validated with a HttpMessageHandler.

    This step is executed with no problem at all.

    The Test Case RAW request form shows the same as the request.

    I am new to HTTP API testing with SoapUI and I was hopping to complement the Unit and Integration with Functional Tests but had no success up until now.

    Cheers

    Carlos
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    So I would validate that your request has the needed HTTP Header. You should be able to see that in the Raw tab view.

    If it does not, you can add and overwrite the HTTP Headers in the 'headers' tab located at bottom of request editor. To make it dynamic, you can use property expansion in header values: http://www.soapui.org/Scripting-Propert ... nsion.html

    Thanks,
    Michael Giller
    SmartBear Software
  • SmartBear Support wrote:
    So I would validate that your request has the needed HTTP Header. You should be able to see that in the Raw tab view.

    If it does not, you can add and overwrite the HTTP Headers in the 'headers' tab located at bottom of request editor. To make it dynamic, you can use property expansion in header values: http://www.soapui.org/Scripting-Propert ... nsion.html

    Thanks,
    Michael Giller
    SmartBear Software


    Hello again Michael.

    If the post was not valid it wouldn't reach the controller since it's validated by the HttpMessageHandler.

    I can see that the headers are valid in the Raw request textbox.

    Do you think this may be some misconfiguration issue? I am lacking ideas here!

    Cheers

    Carlos
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Since you are dealing with .Net, I know by default is uses WsHttpBinding that has a number of WS-* protocols by defaults. Some of them we support, such as:
    - WS-Security http://www.soapui.org/SOAP-and-WSDL/app ... urity.html
    - WS-Addressing http://www.soapui.org/SOAP-and-WSDL/usi ... ssing.html
    - WS-ReliableMessaging http://www.soapui.org/SOAP-and-WSDL/usi ... aging.html

    But there are also a number of other standards used in wsHttpBinding that are not yet supported by SoapUI Pro (e.g. WS-SecureConversation, WS-SecurityPolicy)

    Thanks,
    Michael Giller
    SmartBear Software