Mon*_*key 6 c# int soap web-services asmx
我有一个应用程序,它进行Web服务调用以获取MSI的URL,具体取决于用户的计算机是32位还是64位.
调用GetURLByOS需要2个方法(1.字符串AuthenticationInfo,2.int osBit).在我调试时,我可以看到身份验证信息.调用Web服务时,osBit的值为8(64位).但实际上在Web服务中它的值会丢失(0).
有人能帮我弄清楚整数值丢失的原因吗?
更新:我正在加入这个过程.在客户端中,我看到值8被传入.在Web服务调用中,我看到0.这是一个SOAP Web服务调用.这是客户端上的WSDL代码:
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://mydomain.com/product/1.0/GetURLByOs", RequestNamespace = "http://mydomain.com/product/1.0", ResponseNamespace = "http://mydomain/product/1.0", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string GetURLByOs(string eTicket, int OsBitType)
        {
            object[] results = this.Invoke("GetURLByOs", new object[] {
                        eTicket, OsBitType});
            return ((string)(results[0]));
        }
这是实际的Web服务:
    [WebMethod]
        public string GetURLByOs(string eTicket, int osBitType)
        {
            return MyFacade.GetUrl(eTicket, osBitType);
        }
顺便说一句,当我将参数更改为类型字符串时,它会正确传递(值"8").只有当我将其作为整数传递时,该值才会被清零.
我发现问题出在哪里了。在(客户端)WSDL 代码上,参数是 OsBitType。但在实际的Web服务上,参数是osBitType。将Web服务参数更改为OsBitType后,它工作正常。
奇怪的是,如果参数是字符串,则不会发生这种情况。