0

I'm writing a web service and have passed an object which is showing up as

      <OfferDetail>
        <OfferID>long</OfferID>
        <InterestID>long</InterestID>
        <RangeValue>string</RangeValue>
        <Score>string</Score>
        <Importance>string</Importance>
        <Range>string</Range>
        <ImportanceByOtherUser>string</ImportanceByOtherUser>
        <RangeByOtherUser>string</RangeByOtherUser>
      </OfferDetail>

in the web service placeholder but i don't want the

 <ImportanceByOtherUser>string</ImportanceByOtherUser>
 <RangeByOtherUser>string</RangeByOtherUser>

to be there is the place holders. Note: i can't remove them from the object

John Saunders
  • 160,644
  • 26
  • 247
  • 397
iJade
  • 23,144
  • 56
  • 154
  • 243
  • What, exactly, do you mean by "placeholders"? Do you mean the help page you get when you browse to the web service? Is this an ASMX service or a WCF service? – John Saunders Sep 03 '13 at 14:17
  • @JohnSaunders ys dat is it... – iJade Sep 03 '13 at 14:29
  • ASMX is a legacy technology, and should not be used for new development. WCF should be used for all new development of web service clients and servers. One hint: Microsoft has retired the [ASMX Forum](http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads) on MSDN. – John Saunders Sep 03 '13 at 14:57
  • possible duplicate of [Inherited properties do not appear in soap sample on asmx file](http://stackoverflow.com/questions/1875642/inherited-properties-do-not-appear-in-soap-sample-on-asmx-file) – Grinn Jul 22 '14 at 21:31

4 Answers4

0

If you're using WCF, then you probably have the DataContractAttribute applied to the object whose data you're returning via the service. If this is a service definition (which I doubt, but you didn't post any C# code), then you'll want to get rid of the OperationContractAttribute that's decorating these properties. But I believe it's the latter rather than the former—so I'd look for DataContractAttributes first.

HTH.

fourpastmidnight
  • 4,032
  • 1
  • 35
  • 48
0

Just wondering why ?.

Are this members for internal web service usage, or private data? I've seen sometimes some developers publishing directly the ORM object through the web service. While it may works, It's often a bad idea as you don't want to expose the whole object, but only a subset of the object, or even a composition of several objects (customer's main detail + last orders in the month for example).

Thus I strongly advise you to refactor your code. You should create some DTO objects that are dedicated to data output of your web service, and command objects for input.

You specified you can't change the object, but what about adding another layer?

Steve B
  • 36,818
  • 21
  • 101
  • 174
0

What type of webservice are you using? Depending on this you can use attributes like XmlIgnore, NonSerialized, IgnoreDataMember etc.

See

Question 1

Question 2

Community
  • 1
  • 1
w00ngy
  • 1,646
  • 21
  • 25
0

Its a known bug.

http://archive.msdn.microsoft.com/WsdlHelpGenerator/Release/ProjectReleases.aspx?ReleaseId=412

download the file and add the following in the web config

    <webServices>
 <wsdlHelpGenerator href="CustomWsdlHelpGenerator.aspx"/>
</webServices>

Href should point to the file downloaded in your the project

iJade
  • 23,144
  • 56
  • 154
  • 243