问题
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