Ok so you want to accept xml as part of your web service input - this would
be normal and just requires you to define public properties for the returned
class as xml.

I have not seen Tonys video - it may be that he shows you how to do that
there.

The basic structure would be something like :-


Public Class retclass
    Dim lvar, lfoo as string
    <XmlAttribute(AttributeName:="var")> _
    Public Property var() As String
        Get
            Return lvar
        End Get
        Set(ByVal newval As String)
            lvar = newval
        End Set
    End Property
    <XmlElement(ElementName:="foo")> _
    Public Property foo () As String
        Get
            Return l foo
        End Get
        Set(ByVal newval As String)
            lfoo = newval
        End Set
    End Property
End Class


Then your method for the webservice class
    <WebMethod(Description:="Example method")> _
Public Function example(ByVal blah blah) As retclass

Dim ret as retclass = New retclass
ret.var = "something"
ret.foo = "something else"


Return ret


If you already have an xsd or a dtd or even an example xml for the xml
payload of the soap of webservice, then you can use a command line tool that
comes visual studio called xsd. This will generate the class for you.

The advantage of this is it includes the definition of the xml inside the
wsdl generated for your web service and so helps consumers of your web
service use your service.


Alternative 1
If you do not want to use the class as the return for the webservice and
just take the xml as a string then you can then pass it directly to the
databasic and use the databasic XML extensions to get the data out of it -
just write an EXT (extract) file for it

Alternative 2
You could do the class approach above but still want to pass the entire xml
through to your databasic. You will need to serialise the instance of the
class to a string and pass this - this is not immediately obvious in .net
but I have example code for this if you require (about 30 lines of code).

Alternative 3
You could do alternative 1 but then deserialize the xml string into an
object before passing the individual variables to your databasic. Again i
have examples on how to deserialize, you would have to create a class
similar to the main approach but utilise it within your code rather than let
asp.net do the work for you.

Alternative 4 - you could use the DOM in your .net code

Alternative x - possibly many altertnatives.


Hth 
Symeon.


-----Original Message-----
From: owner-u2-us...@listserver.u2ug.org
[mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of
iggch...@comcast.net
Sent: 12 March 2009 22:57
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Web Services

Hey, thanks a lot for taking the time to offer this.



Now for some follow up questions.



In Universe, a basic example of my subroutine would look likeb&





B 

subroutine pricing(cust,items,qtys,prices)



B7 B B B B B B B B  pass in cust,items, and qtys



B7 B B B B B B B B  return prices associated to each item



B B  item.max = dcount(items,@am)



B B  for item.ptr = 1 to item.max



B B B B B B  prices <item.ptr> = 12345



B B  next item.ptr



return





B 

B 



What I'm supposed to be offering up as input is B something like (trimmed
down
to save space)...





B 

<GETPRICEQUOTEInput>



B  <QUOTES>



B B B  <CUSTOMERID>31997</CUSTOMERID>



B  </QUOTES>



B  <QUOTEITEMS>



B B B  <QUOTEITEM>



B B B B B  <ITEMID>5017</ITEMID>



B B B B B  <QTY>2</QTY>



B B B  </QUOTEITEM>



B  </QUOTEITEMS>



</GETPRICEQUOTEInput>







B 



The closest I could get with the u2wsd was...





B 

<GETPRICEQUOTEInput>



B B B  <CUSTOMERID>31997</CUSTOMERID>



B  <QUOTEITEMS>



B B B B B  <ITEMID>5017</ITEMID>



B B B B B  <QTY>2</QTY>



B  </QUOTEITEMS>



</GETPRICEQUOTEInput>









B 

What I need to return is basically the same thing as the xml passed in but
with an additional element named <PRICE>.









You wouldn't happen to have an example of how to parse the xml data into
arrays for arguments to the uv sub would you?



As long as I'm asking for that...B  What about an example of how to create
the
xml from the uv arrays?B 



And heck, as long as I'm getting bold... How would I generateB the wsdl so
the
client knows what I'm offering?







Although I do have visual studio 2008, I haven't done anything with it
yet.B B I was hoping to start learning it, but at my own pace.



Now I'm under the gun!

B 



B 

Sorry for such basic questions and thanks a ton B for the guidance.



I remember writing the backend for a website on our Universe system back in
2000.B  I was creating xml and pushing it out to Microsoft Message Queue
service using a GCI routine someone wrote for usB in C.B  It was so easy to
build the XML and pass it back.B  This stuff seems pretty complicated.





Here's another question.B  I have a thermos.B  I can put hot stuff in it, it
keeps it hot.B  I can put cold stuff in it, it keeps it cold.B  How do it
know?



B 




----- Original Message -----
From: "Symeon Breen" <syme...@gmail.com>
To: u2-users@listserver.u2ug.org
Sent: Thursday, March 12, 2009 3:34:10 PM GMT -06:00 US/Canada Central
Subject: RE: [U2] Web Services

It is very easy to write an asp.net web service that connects to unidata
using uniobjects.net - hey i have even included some code below for you to
look at


Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports IBMU2.UODOTNET

' Example web service by Symeon Breen, a2c limited, Lancashire, UK
' Please change the namespace if it is to be used or copied.

<WebService(Description:="example web service using uniobjects.net",
name:="WebService", Namespace:="http://tempuri.org/";)> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class WebService
B B  B Inherits System.Web.Services.WebService



B B  B <WebMethod(Description:="Example method")> _
B B  B Public Function example1(ByVal host As String, ByVal account As
String,
ByVal connection As String, ByVal login As String, ByVal password As String,
ByVal param As String) As String

B B  B  B  B ' example 1 takes in parameters of :-
B B  B  B  B ' host - u2 host ip or name
B B  B  B  B ' account - account path or name
B B  B  B  B ' connection - connection type e.g udcs for unidata
B B  B  B  B ' login - username to login as
B B  B  B  B ' password - password for username
B B  B  B  B ' These parameters are passed in as an example, for security
you
may
wish to hard code or parameterise these at the webserver in the web.config
as connection strings. Then the data passed into the webservice would be for
its function not connection.

B B  B  B  B ' This webservice will connect to u2 on host and account and
run
the
databasic program WSexample passing in param. WSexample will pass back some
text that this web service then passes back to the client as a string.
Ideally a class should be defined with public properties exposed as XML and
this method would return the class hence a full xml doc can be produced.

B B  B  B  B ' NB bin directory should contain the uniobjects.net dll
(UODOTNET.dll)


B B  B  B  B Dim u2Session As UniSession = Nothing
B B  B  B  B Dim rtnMessage As String = String.Empty
B B  B  B  B Dim u2Sub As UniSubroutine

B B  B  B  B UniObjects.UOPooling = True
B B  B  B  B UniObjects.MaxPoolSize = 2
B B  B  B  B UniObjects.MinPoolSize = 1


B B  B  B  B Try
B B  B  B  B  B  B u2Session = UniObjects.OpenSession(host, login, password,
account, connection)

B B  B  B  B  B  B Try
B B  B  B  B  B  B  B  B u2Sub = u2Session.CreateUniSubroutine("WSexample",
2)
B B  B  B  B  B  B  B  B u2Sub.SetArg(0, param)

B B  B  B  B  B  B  B  B u2Sub.Call()
B B  B  B  B  B  B  B  B rtnMessage = u2Sub.GetArg(1)

B B  B  B  B  B  B Catch ex As Exception
B B  B  B  B  B  B  B  B rtnMessage = "ERROR - In call to sub - " &
ex.ToString
B B  B  B  B  B  B Finally
B B  B  B  B  B  B  B  B u2Sub = Nothing
B B  B  B  B  B  B  B  B UniObjects.CloseSession(u2Session)
B B  B  B  B  B  B End Try
B B  B  B  B Catch ex As Exception
B B  B  B  B  B  B rtnMessage = "ERROR - " & ex.ToString
B B  B  B  B Finally
B B  B  B  B  B  B u2Session = Nothing
B B  B  B  B End Try

B B  B  B  B Return rtnMessage

B B  B End Function

End Class





Easy ?? B  I thinks so ....




-----Original Message-----
From: owner-u2-us...@listserver.u2ug.org
[mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of
iggch...@comcast.net
Sent: 12 March 2009 19:32
To: u2-Users
Subject: [U2] Web Services

Hi all,



UV10.2.7

HPUX 11.23



Does anyone know if it is possible to use IBM WebSphere Development Studio
Client Tool to develop web services for Universe?B B I've been trying to use
the Web Services Developer but cannot seem to create all of the necessary
nesting levels required by the client application .B B I am now searching
for
alternatives.



Thanks much for any info you can provide,



Scott Thompson
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to