Amira
Amira

Reputation: 3270

web reference : How to change proxy class code

i'm using web reference to consume a web service the problem is with a decimal attribute which is optional , its value is not passed the web service. i tried to add default attribute and give it a default value it works fine , but i can not change my wsdl because i have differenet clients working with it (php,java ... clients) The problem is well described here : msdn post stackoverflow post

So i want to find a way to change the code of the proxy class generated after the creation of yhe web reference , because i'm sure it's a bug caused by this class which treats optional decimal attributes wrongly .

Upvotes: 0

Views: 3090

Answers (1)

Nullius
Nullius

Reputation: 2702

Solution 1:

  • Go to your project folder -> Web References -> MyService.
  • In there, there should be a file called Reference.cs ... that's the file that is created. It contains proxy classes for the webservice.

Also, if you don't want to mistakenly update the reference and delete your changes to the file, update the reference in the csproj file. On the bottom of the project file, you'll find url's to all services you're using. Point it to the WSDL in the same folder.

Solution 2:

  • Add the service reference to your project
  • Change your project file and update the url of the service, point it to the wsdl in the same folder as in solution 1
  • Make the necessary changes to the wsdl in the same folder
  • Update the reference in VS ... this will create a new Reference.cs ... it will update the proxy classes

NOTE: Depending on the changes made to the WSDL, it might be the web service on the other side might not be able to 'read' your messages. Making a property obligated instead of optional should not break it though.

Upvotes: 1

Related Questions