ASMX Webservice, Test Form only available on local machine for one WebMethod only

亡梦爱人 提交于 2019-12-23 18:27:13

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8037505/asmx-webservice-test-form-only-available-on-local-machine-for-one-webmethod-onl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!