0

I'm writing a WebService in .NET and use a custom type with no public properties. It looks like this: Class diagramm for MacAddress

It is similar to the built-in type Guid but with special validation rules for MAC addresses. The SOAP description looks like this:

<StringProperty>string</StringProperty>
<GuidProperty>guid</GuidProperty>
<MacAddressProperty />
<!--My aim: <MacAddressProperty>macaddress</MacAddressProperty> -->

My question: Can I create a type like MacAddress to ensure type-safety and use it as parameter for a WebService? How can I say that the delivered string from the caller should be filled in the parameterized constructor (probably like Guid works - it has a constructor with a string-parameter)?

Thanks Alex

Alex
  • 755
  • 1
  • 7
  • 12

1 Answers1

1

If you use properties values in your struct and parametrized it as vieweable by the web service. Your property will be filled/serialized prior sendind it to the client.

See this tutorial, maybe it will help understand the mechanics.

http://www.codeproject.com/KB/WCF/first_WCF_Service.aspx

dutertimes
  • 137
  • 1
  • 9
  • Maybe I'm wrong but as mentioned in another comment I don't use WCF. Nevertheless I will have a look to the article. – Alex Oct 26 '10 at 14:59