悬赏分:30 浏览:179 次
例如我有两个webservice (service1,service2),有个一类叫Product,我在两个webserice中都使用了AddProduct(Product domainObject)方法;现在的问题是我添加了webservice引用后会生成两个代理类(Service1.Product,Service2.Product),怎么只生成一个代理类啊
|
2个月前 飄lá┽蕩去 : 受教了,不过还是很麻烦,不是很智能 |
|
2个月前 飄lá┽蕩去 : Proxy Type Sharing ASP.NET Web Services now supports proxy type sharing. This feature allows you to share identical types from different Web services within the client-side proxy class. For example, you can take a type instance returned from one web service and pass it to another, and vice versa. In this sample, a product invoice is returned from the Ordering Center. The user then wishes to update the ship date on the order. To do so, the user passes the same ProductInvoice instance to the Shipping Center, which updates the order and returns the modified product invoice. How do you identify identical types? Identical types have the same type name and namespace, and also share the same schema type definition. In this sample we indicate that types should be shared by putting the wsdl and discomap from each service in the 'App_WebReferences' directory. If you wish to use wsdl.exe instead to create your client proxy here is the command to share types between TypeSharingService1 and TypeSharingService2: <!-- To share types, use the /sharetypes flag with wsdl.exe. For example (all in one line): --> wsdl.exe /sharetypes http://localhost/QuickstartV20/webservices/Samples/TypeSharing/cs/Server/TypeSharingService1.asmx http://localhost/QuickstartV20/webservices/Samples/TypeSharing/cs/Server/TypeSharingService2.asmx |