ASMX Webservice, Test Form only available on local

2019-07-05 03:33发布

I have an ASMX WebService that I am testing, and on most of the methods I am able to use the test form just fine for testing. I do however have one method for which the test form says:

The test form is only available for requests from the local machine.

This method is declared exactly the same way the other methods, but it does have a noticeably longer parameter list (most of these methods only have 2 or 3 params):

[WebMethod]
    public ActionSuccessResponse makeDestinationRequest(String ownerID, String destinationRegion, String destinationCountry, DateTime desiredTravelDate1, String destinationCity = "", DateTime? desiredTravelDate2 = null, DateTime? desiredTravelDate3 = null) {

Any ideas? I'm stumped.

2条回答
神经病院院长
2楼-- · 2019-07-05 03:53

As it turns out, the problem was actually occurring due to the DateTime typed parameters in the method definition. Web Services should use primitive data types for all parameters to allow for compatibility with other languages.

查看更多
贪生不怕死
3楼-- · 2019-07-05 03:56

If you must use the older ASMX files, you should test them with something like SOAPUI.

The built-in test page only handles very basic parameter entry (and probably has a limit on the number of parameters before it gives up). Basically don't use it.

查看更多
登录 后发表回答