Groups > Asp .Net > ASP.NET XML Web Services > Re: Expose objects to client (developer)




Expose objects to client (developer)

Expose objects to client (developer)
Thu, 27 Mar 2008 10:53:26 +000
Hello, I'm new to the forums and have a problem regarding a solution I need do
to develop.
I already tried posting on other ASP.NET related forums with no success. This
time I will try to keep it simple and gradually explain my problem if there
should be any missunderstandings in my problem.

 
I need to develop a Web Service solution for printing Crystal Reports. Reports
will be designed, created and deployed by me. The datasource for reports can
vary from DataSets, Objects, XML files. At this point I don't really care what
the datasource would be.
This solution must be available to (many) other developers using it in a way
that enables them to send/pass data into Web Service and print a report.

How can I expose datasource objects and properties to developers?

1. create Typed DataSets (used for each report) and send them to other
developers - send them by email? What happens on changes, there can be up to 200
DataSets?
2. create XSD schemas (derived from Typed DataSets) and serve them from a common
physical location - they could make their own DataSets, fill them, send them to
my Web Service.
3. create an Object with public properties and serve them with
<System.Xml.Serialization.XmlInclude(GetType(MyObject))> - I done this and
it works perfect! Outside developers have Intelisense, like
MyObject.PropertyName1 which is a perfect solution since they can actually see
required Properties for each object in my solution (fill them and send to Web
Service). The problem is that I cannot make it work so they can send multiple
(array or table-like) data - each property only accepts one value, there is no
MyObject.PropertyName1.Add.


...and there I go complicating things again.
This is more an "idea wanted" post rather than "fix my
code", I am open to any suggestions and thankful for each of them!
Post Reply
Re: Expose objects to client (developer)
Thu, 27 Mar 2008 19:04:44 +000
Story of my (forums) life... got the solution a few hours after posting here.
Anyways, here is my solution. Not 100% what I need, but I'm sure I can refine it
so to conform it to my and others' demands.
 

CLASS in WebService


---------------------

 Public Class Phone
        Private ModelPh As String
        Public Property MyModel()
            Get
                Return Me.ModelPh
            End Get
            Set(ByVal value)
                Me.ModelPh = value
            End Set
        End Property

        Private cifra As String
        Public Property MyCifra()
            Get
                Return Me.cifra
            End Get
            Set(ByVal value)
                Me.cifra = value
            End Set
        End Property

    End Class

---------------------------- 

WS Method

<WebMethod()> _
        Public Function SetPhones(ByVal phonesList As Phone()) As String
            Dim answer As String = ""
            For Each phn As Phone In phonesList
                answer += phn.MyModel.ToString() & " " &
phn.MyCifra.ToString & " -- "
            Next
            Return answer
        End Function 

--------------------------

Client

 Dim myPhones(2) As nPrint_1Client.nPrint_1_WS.Phone
        
        Dim nokia As nPrint_1_WS.Phone = New nPrint_1_WS.Phone()
        nokia.MyModel = "N90"
        nokia.MyCifra = "040 FND-SLN"

       <snipsnip>

        myPhones(0) = nokia
        myPhones(1) = motorola
        myPhones(2) = sony

        Dim ws_nPrint As nPrint_1_WS.Service = New nPrint_1_WS.Service
        ws_nPrint.Credentials =
System.Net.CredentialCache.DefaultNetworkCredentials
        Dim a As String = ws_nPrint.SetPhones(myPhones).ToString
        MsgBox(a)
Post Reply
Re: Expose objects to client (developer)
Wed, 2 Apr 2008 11:34:28 +0000
Hi IztokS ,

Thank you very much for sharing your solution. 

Best regards,
Guang-Ming Bian - MSFT
Post Reply
about | contact