我已经使用c#制作了自己的asmx Web服务。我的主要班级是这样的
[WebService(Namespace = "my.namespace")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[SoapDocumentService(SoapBindingUse.Literal,SoapParameterStyle.Bare,RoutingStyle = SoapServiceRoutingStyle.RequestElement)]
public class ICService : system.web.Services.WebService
{
[WebMethod()]
public ProductListResponse GetProductList(ProductListRequest ProductListRequest) { ... }
}
如果我在网络上查看此方法的xml请求,则结果如下:
<soap:Body>
<ProductListRequest xmlns="my.namespace">
. . .
</ProductListRequest>
</soap:Body>
一切正常,但是当我在任何其他项目中添加对此WS的引用时,我需要为方法调用添加额外的注释。这不是什么大问题,但我想知道为什么会这样。
通话示例:
GetProductListResponse resp = client.GetProductList(new GetProductListRequest
{
ProductListRequest = new ProductListRequest { }
});
此 GetProductListRequest 类来自何处? Anwser似乎还有一些额外的类:GetProductListResponse.GetProductListResult.Products,而不只是ProductListResponse.Products。
我已经使用了许多其他Web服务,但是这种行为对我来说是新的。