开发者

ASMX Web Reference not Updating After Service Return Type Updated

开发者 https://www.devze.com 2022-12-20 16:53 出处:网络
I have a webservice - called MyCompany.WebService1 I reference this using a web reference in my ASP.net web application.

I have a webservice - called MyCompany.WebService1

I reference this using a web reference in my ASP.net web application.

Theres a method called "GetDeal" in this web service, that returns a "Deal" Object. The deal object currently looks (for example) like this:

public class Deal
{
    Public string Name {get;set;}
    Public string Description {get;set;}
}

This class is in a different assembly: MyCompany.Model

The web service ref开发者_StackOverflow社区erences this assembly.

In my web app, I can call the GetDeal method. This returns Service1.Deal (service1 is just the name of the web reference)

I can access both properties above.

I have now changed the Deal class, and added a couple more properties. However, I can't see these new properties in my web application.

I've updated the web service in the web application. I rebuilt the web service several times, tried removing the MyCompany.Model reference and re-addding it etc...

I can't figure out what has changed... This was working - I have changed the model before, and it's updated the reference correctly...

Anything I've missed?


As long as the following points are fulfilled, this should work:

  • the new property is marked as Public and must be read/write (must have a getter and a setter)
  • you have compiled the host web application (the web app which exposes the web service).
  • (You can try calling the web service in a web browser to check whether the new property is visible).
  • you have updated the web reference the client application (and rebuilt the app)


In addition to what Martin suggests, you have to actually run the updated service.

I recommend you look at the WSDL to see if the changes took effect. Add "?wsdl" to the web service URL in the browser, and look to see if your new properties appear in the XML Schema at the top.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号