From: Pete Dashwood on

"Charles Hottel" <chottel(a)earthlink.net> wrote in message
news:epp4i.13336$j63.3581(a)newsread2.news.pas.earthlink.net...
>
> "Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> wrote in message
> news:5bddsqF2sd0m9U1(a)mid.individual.net...
>> I've had a couple of private mails after responding publicly here to a
>> request for help with accessing Web Services from COBOL.
<snipped unreferenced previous>

>
> Thanks for these postings on web services, Pete.
>

I'm really happy to help. I think it is important that we all share
solutions, rather than do it through private mail. (Besides, it is quicker
for me to post here than respond individually.)

> You make me want to jump into C# but one of my problems with the pc world
> of software has been maintaining my focus. So for now I am still
> pursuring Java.

Java is a very useful OO language. You won't regret learning it. I prefer C#
because it embodies the good parts of Java, but is more straightforward. (It
has also been influenced by C++, and, again, takes the better parts of that
language...). Most importantly though, C# is dedicated to DotNET and is the
most facile solution for unlocking the power of the DotNET FCL (Framework
Class Library), which has around 80,000 classes in it... :-)

There is no point in getting emotional about computer programming
languages... whatever works is good, but some languages are better suited to
some environments than others.


> Effective Java by Jousha Bloch is great and after that I believe I will be
> ready for Design Patterns by Gamma etc. I tried to read Design Patterns
> before but I kept having to consciously think about the meanings of the
> terms. A recent skim showed me that now I have internalized the concepts
> enough and have a more intuitive understanding when reading. I still have
> much to learn and Java keeps evolving and I am still not up to date on all
> the latest and greatest additions.
>

Speaking of reading... I am working my way through "The Singularity is Near"
as you recommended. I find it stimulating and interesting. Will post my
overall impressions when I've finished it. At 20 minutes a night, it may be
some time...:-)

> At some point where I feel I am prepared for anything I am called upon to
> do at work with Java, I will look into C#, I have Murach's C# book.

Don't know the book so cannot comment. I found the interactive videos were
fantastic and got me up to speed with C# and VS 2005 very quickly (and
painlessly...). I'm not sure if they are still being offered; sometimes,
good offers don't last too long :-).

Pete.


From: Rene_Surop on
Quite interesting.

Web Service is a great prerequisite for automated client-side code
generation in the mainstream Java and .NET SOAP frameworks. It's a
multi-language technology tool really, it could be C#, Cobol, Java.

Just wonderin', is there anyone who could provide NetExpress Cobol
code (Microfocus) similar above??

From: Rene_Surop on
>
> I could say 'Do your own bloody homework !" :-)
>
> Can't remember do you only have N/E 3.1 or do you also have V 5.0 ?
> If you have V 5.0 then I think the source should compile - whether yours
> works or not, that's another matter.
>

Haha.... was expecting that, well it is suppose to be a quote from
"docdwarf" :-)

Yap, you're right I'm still in N/E 3.1

Though I was given NetExpress with .NET evaluation copy, I didn't
really used it that much because MF suddenly released N/E 4.0.... and
to V5.0. Hoping I could have a copy of it. But until then, I am
preoccupied viewing their demo on Interface Mapping Toolkit.

From: Pete Dashwood on

"James J. Gavan" <jgavandeletethis(a)shaw.ca> wrote in message
news:g2v4i.206393$aG1.36136(a)pd7urf3no...
> Rene_Surop wrote:
>> Quite interesting.
>>
>> Web Service is a great prerequisite for automated client-side code
>> generation in the mainstream Java and .NET SOAP frameworks. It's a
>> multi-language technology tool really, it could be C#, Cobol, Java.
>>
>> Just wonderin', is there anyone who could provide NetExpress Cobol
>> code (Microfocus) similar above??
>>
> Rene,
>
> I could say 'Do your own bloody homework !" :-)

I'd forgive you for doing so :-) It seems to me to be stretching the
friendship to just sit back and let others do the work... Everything needed
to convert my code to MicroFocus can be found on the web (see below).
>
> Can't remember do you only have N/E 3.1 or do you also have V 5.0 ?
> If you have V 5.0 then I think the source should compile - whether yours
> works or not, that's another matter.

I'm very impressed that you would go to the trouble to do this, Jimmy.

So much so, I decided try and fix what you've posted, so it will work.

I don't have NE so I can't test the changes proposed below, but maybe you
could?

There are also a few responses to your comments and some general comments on
accessing COM servers from MicroFocus COBOL.

>
> If you are still back at N/E V 3.1 then you have problems. You will
> probably need to use the ISO 2000 directive like I've shown as the first
> line of the source below. You might also need Repository directives - but
> I keep getting syntax errors. If you read up on Directives for
> 2000/Repository, although you can simulate the *intended* COBOL 2000 (ha,
> ha, bloody ha !), it doesn't do any conformance checking in N/E 3.1.

I don't think using repository is the best way to go (although it is for
Fujitsu). I've used your Class-Control instead.
>
> I've dickered around with Pete's source and at this point in time there
> are only three compiler errors :-
>
> 1 - doesn't like where I've placed my substitute Class-Control entry
> 2 - doesn't like Line 210 - but that's associated with # 1

I hope that giving it the proper MF COM interface will resolve this.

> 3 - Line 642 doesn't recognize invoke COM - again back to #1 above ?

It never could. COM is a Fujitsu Class used to interface to COM components.
The equivalent in MF is $OLE$
>
> If you try other permutations I anticipate you will get a slightly
> different set of errors.
>
> I don't know if you can get it working without Repository syntax - I doubt
> it - just have to suck and see.

No, I believe it can work without Repository. It will be late bound anyway.

> Anyway as is, the source is just down to three errors. So now you can take
> over :-) - you can zip me back a copy if you get it working with N/E 3.1 -
> no point if you only do it with N/E 5.0. (If for some unknown reason the
> source below wraps around, e-mail me and I'll send the N/E source file as
> a zip).
>
> Note for Pete - what you transmitted - a bit of a pain in the butt, but
> not your intent :-). First I highlighted and pasted and each line was
> preceded by '>'. Then the problem with the wrap around comments.

That's because I use free-format COBOL and some of the lines were more than
76 bytes wide. Sorry.

Normally, I'd post it as COBOL source to a server and let people download
it, but it was so small I thought it would be easier to post it here and
hopefully stimulate some responses form people who tried using it.


> Probably OK if you were passing a source zipped file, but these damned
> e-mail programs aren't that clever. (My own style just using Columns 8
> thru 72 I enter '*>' in columns 8 and 9 - that allows me to highlight ( 1
> thru 72) and paste without wrap-arounds).
>
> EDITED SOURCE :
>
> $set iso2000 ooctrl(+p)

As we are accessing a COM server (The SOAP Component) you need the above MF
directive...it ensures parameters are passed correctly to the MF Run Time.
>
> *> This 'PARTIAL' version for Net Express V 3.1
>
> 000010 IDENTIFICATION DIVISION.
> 000020 PROGRAM-ID. 'SOAPTest'.
> 000030*AUTHOR. Peter E. C. Dashwood. *MODIFIED for MicroFocus by Jimmy
> Gavan.

> 000031*
> 000040* This program attempts to instantiate a SOAP Proxy class and
> 000050* access a Web Service using the new proxy...
> 000051*
> 000060*DATE_WRITTEN. May 2007.
> 000070 ENVIRONMENT DIVISION.
> 000080 configuration section.
> 000090 source-computer. IBM-PC.
> 000100 object-computer. IBM-PC.
>
> Class-Control. *> COM Class is "*com". (Can't work. COM is a
> Fujitsu Class.)

MSSOAP is class "$OLE$MSSOAP.SoapClient30"
>
> * Three possibilities for Repository Directive, kept on getting
> * errors 'Can't use here' :-

>
> * $set Repository Off
> * $set Repository Update
> * $set Repository Checking
>
>
> 000101 *>REPOSITORY.
> 000110 *> CLASS COM AS "*COM".
> 000120
> 000170
> 000200*------------------------ DATA DIVISION ---------------------
> 000210 DATA DIVISION.
> 000340*
> 000350 WORKING-STORAGE SECTION.
> 000360 01 in-interface-block pic x(8197).
> 000361 01 in-IB.
> 000362 12 in-ws-return pic x(5).
> 000363 88 in-ws-OK value '00000'. *> will contain SQLSTATE if
> 000364 *> there is a DB error
> 000365 12 in-ws-message pic x(256). *> will contain SQLMSG if
> 000366 *> there is a DB error
> 000367 12 in-ws-buffer pic x(2048). *> holds free format address
> data
> 000368 *> this will be formatted on
> return
> 000369 12 in-ws-breakdown.
> 000370 15 in-ws-streetNo pic x(20).
> 000371 15 in-ws-POBoxNo pic x(15).
> 000372 15 in-ws-RDNo pic x(8).
> 000373 15 in-ws-street pic x(150).
> 000374 15 in-ws-locality pic x(150).
> 000375 15 in-ws-city pic x(50).
> 000376 15 in-ws-lobby pic x(150).
> 000377 15 in-ws-postCode pic x(4).
> 000378 15 in-ws-addressType pic x(1).
> 000379 15 in-ws-streetSDX pic x(4).
> 000380 15 in-ws-localitySDX pic x(4).
> 000381 15 in-ws-lobbySDX pic x(4).
> 000382 15 in-ws-prologue pic x(100).
> 000383 12 in-ws-interface pic x.
> 000384 88 in-free-format-input value '1'.
> 000385 88 fixed-field-input value '2'.
> 000386 88 XML-input value '3'.
> 000387 12 in-ws-streetMatchFlag pic x(1).
> 000388 88 street-fuzzy value '0'.
> 000389 88 street-exact value '1'.
> 000390 12 in-ws-localityMatchFlag pic x(1).
> 000391 88 locality-fuzzy value '0'.
> 000392 88 locality-exact value '1'.
> 000393 12 in-ws-repeatLocalityFlag pic x(1).
> 000394 88 no-Locality value '1'.
> 000395 88 repeatLocality value '0'.
> *> used if Locality = City
> 000396 12 in-ws-ignoreInvalidPostcode pic x(1).
> 000397 88 ignoreInvalidPostCode value '1'.
> 000398 88 reportInvalidPostCode value '0'.
> *>stops if Post Code is invalid
> 000399 12 in-ws-foreignFlag pic x(1).
> 000400 88 foreign-address value '1'.
> *>stops if foreign address detected
> 000401 88 NOT-foreign-address value '0'.
> 000402
> 000403 01 out-interface-block pic x(8197).
> 000405 01 out-IB.
> 000406
> 000407 12 out-ws-return pic x(5).
> 000408 88 out-ws-OK value '00000'.
> *> will contain SQLSTATE if
> 000409 *> there is a DB error
> 000410 12 out-ws-message pic x(256). *> will contain SQLMSG if
> 000411 *> there is a DB error
> 000412 12 out-ws-buffer pic x(2048).
> *> holds free format address data
> 000413 *> this will be formatted on return
> 000414 12 out-ws-breakdown.
> 000415 15 out-ws-streetNo pic x(20).
> 000416 15 out-ws-POBoxNo pic x(15).
> 000417 15 out-ws-RDNo pic x(8).
> 000418 15 out-ws-street pic x(150).
> 000419 15 out-ws-locality pic x(150).
> 000420 15 out-ws-city pic x(50).
> 000421 15 out-ws-lobby pic x(150).
> 000422 15 out-ws-postCode pic x(4).
> 000423 15 out-ws-addressType pic x(1).
> 000424 15 out-ws-streetSDX pic x(4).
> 000425 15 out-ws-localitySDX pic x(4).
> 000426 15 out-ws-lobbySDX pic x(4).
> 000427 15 out-ws-prologue pic x(100).
> 000428 12 out-ws-interface pic x.
> 000429 88 free-format-input value '1'.
> 000430 88 fixed-field-input value '2'.
> 000431 88 XML-input value '3'.
> 000432 12 out-ws-streetMatchFlag pic x(1).
> 000433 88 street-fuzzy value '0'.
> 000434 88 street-exact value '1'.
> 000435 12 out-ws-localityMatchFlag pic x(1).
> 000436 88 locality-fuzzy value '0'.
> 000437 88 locality-exact value '1'.
> 000438 12 out-ws-repeatLocalityFlag pic x(1).
> 000439 88 no-Locality value '1'.
> 000440 88 repeatLocality value '0'.
> *> used if Locality = City
> 000441 12 out-ws-ignoreInvalidPostcode pic x(1).
> 000442 88 ignoreInvalidPostCode value '1'.
> 000443 88 reportInvalidPostCode value '0'.
> *> stops if Post Code is invalid
> 000444 12 out-ws-foreignFlag pic x(1).
> 000445 88 foreign-address value '1'.
> *>stops if foreign address detected
> 000446 88 NOT-foreign-address value '0'.
> 000447
> 000448
> 000449 01 WSDL-reference value
> 000450* WSDL to connect to the remote host (in San Francisco)
> z'http://primacomputing.co.nz/AVSWebService/AVSWebService.asmx?WSD
> -'L'.

The above literal needs a z in front and removal of the picture (I think?)
to indicate an ASCIIZ string, for MF.

I'm a bit worried about continuation of this string, Jimmy. It is critical
that the string is presented intact. If it doesn't work when you step
through it, try concatenating sections of the string, or STRING it into
WSDL-reference.

> 000451
>
> 000452* WSDL to connect to my IIS server on my new VAIO notebook
> * machine over wireless LAN.
> 000453* 'http://bigblack/AVSWebService/AVSWebService.asmx?WSDL'.
> 000454*
> 000455* I have tested both of the above and they both work perfectly.
> * Web services can
> 000456* be hosted anywhere you like and accessed from anywhere on Earth.
> * It's magic...!!
> 000457* (Like DCOM+ on steroids...)
> 000458

You don't need the following, because it is included in the Class-Control
entry...
> 000459 01 COMServer-ProgIDs.
> 000460 12 SOAP-ProgID pic x(19) value
> 000461 "MSSOAP.SoapClient30".


> 000462
> 000463 01 COMServer-Objects.
> 000464 12 objSOAPClient OBJECT REFERENCE. *> COM.
> 000465
> 000466 01 subscripts usage comp-5.
> 000467 12 J pic s9(5).
> 000468 12 K pic s9(5).
> 000469
> 000470 01 end-flag pic x.
> 000471 88 not-finished value zero.
> 000472 88 finished value '1'.
> 000473
> 000487
> 000490 PROCEDURE DIVISION.
> 000500 MAIN SECTION.
> 000510 a000.
> 000520 perform startup-housekeeping
> 000530 perform main-logic until finished
> 000540 perform close-down
> 000550 .
> 000560 a999.
> 000570 stop run.
> 000580*-----------------------------------------------------------
> 000590 STARTUP-HOUSEKEEPING section.
> 000600 sh000.
> 000640 set not-finished to TRUE

This can't work because you have no established reference to COM
> 000641* Instantiate SOAP COM Server...
> 000642 invoke COM "CREATE-OBJECT" using SOAP-ProgID
> 000643 returning objSOAPClient
> 000644 end-invoke

Try this instead...
invoke MSSOAP "new"
returning objSOAPClient
end-invoke


> 000645* Initialize the SOAP Server and point it at the WSDL for the Web
> * Service
> 000646 invoke objSOAPClient "mssoapinit"
> 000647 using WSDL-reference
> 000648 end-invoke
> 000649* At this point the objSOAPClient reference has become a proxy for
> * the AVS Web Service...
> 000650* This means you can reference any of the methods/properties/events
> * exposed by the Web Service,
> 000651* as if they belonged to the objSOAPClient object...
> 000652 .
> 000660 sh999.
> 000670 exit.
> 000680*-----------------------------------------------------------
> 000690 MAIN-LOGIC section.
> 000700 ml000.
> 000701*
> 000707*
> 000708* Now try the methods...
> 000709*
> 000710* The AVS Web Service only exposes one method, but the underlying
> * COM object has several.
> 000711
> 000712* Set up an address string... (Not essential... if you
> 000714* pass a blank interface block to AVS it will return a message in
> * the ws-message
> 000715* area telling you it was invalid...)
> 000716 move spaces to in-IB
> 000718 set in-free-format-input to TRUE
> 000719 move '97 21ST AVE TAURANGA' to in-ws-buffer *> A NZ address...
> 000720 move in-IB to in-interface-block
> 000721 *> Note that string parameters to COM objects must be 8197
> bytes
> 000722 *> and must be elemental.
> 000723
> 000724 invoke objSOAPClient "ValidateNZaddress"
> 000725 using in-interface-block *> input interface block
> 000726 returning out-interface-block *> output interface block
> 000727 *> Note that you could use just one block
> 000728 *> but you must reference it in and out because the
> 000729 *> Web Service expects in and out parameters n
> 000730
> 000731 end-invoke
> 000732*========================== SOAP XML Stringing error fix
> 000733* There is currently a problem with SOAP stripping out certain
> * characters
> 000734* in the returned string. This causes fields to be aligned
> * incorrectly. The
> 000735* following is a quick fix and won't be required once the service
> * is released.
> 000736*
> 000737 move 1 to K *> output buffer pointer
> 000746 perform
> 000756 varying J *> input buffer pointer (for this process)
> 000757 from 1
> 000758 by 1
> 000759 until K > function LENGTH (out-IB)
> 000760 move out-interface-block (J:1) to out-IB (K:1)
> 000761 add 1 to K
> 000762 if out-interface-block (J:1) = x'0A'
> 000763 move space to out-IB (K:1)
> 000764 add 1 to K
> 000765 end-if
> 000766 end-perform
> 000769
> 000770*
> 000771* ALL of the above code would be replaced by:
> 000772*
> 000773* move out-interface-block to out-IB
> 000774*
> 000775* ...once the COM server and SOAP wrapper are fixed. (I'm working
> * on it... :-))
> 000776*
> 000777*============ End of SOAP XML Stringing error fix ===========
> 000778*
> 000779
> 000780* Debugging Note
> 000781*
> 000782* Now is a good time to look at out-ws-breakdown and
> * out-ws-buffer...
> 000783*
> 000784* If you are stepping through this in the debugger, note that each
> * field has been
> 000785* filled in, (street number, street, locality, region, and postcode)
> * and the
> 000786* ws-buffer area now contains a properly formatted address which
> * complies with
> 000787* NZPO requirements, and has been converted to mixed case.
> 000788*
> 000789 set finished to TRUE
> 000790
> 000791 .
> 001210 ml999.
> 001220 exit.
> 001230*----------------------------------------------------------
> 001240 CLOSE-DOWN section.
> 001250 cd000.

Fujitsu is OK with NULL, but MF requires a specific invoke of the
finalizer...
> 001260 *> set objSOAPClient to NULL *> Help the garbage collector ...

invoke objSOAPClient "finalize" returning objSOAPClient

> 001340 .
> 001350 cd999.
> 001360 exit.
> 001370*---------------- END OF PROGRAM 'SOAPTEST' ----------------

I am hopeful that the above very minor changes will enable you to compile
and run this code in the Animator/Debugger.

It will be cool if you get it to work. Remember, the service is running on a
farm in San Francisco, let us know what your response is like.

Here are some other valid NZ addresses you could feed into it:

APT 510 GRACE JOEL VILLAGE 184 ST HELIERS BAY RD AUCKLAND
CARMELITE MONASTERY 52 HALSWELL RD CHCH
3/13A VOSPER ST MATAMATA
P O BOX 10042 TE MAI

(Valid postcodes and localites/regions should be returned for all of these.
It is just to show the flexibility of the free format input.)

If you are still getting compile errors, please post here and I'll take
another look at it.

Note to ALL:

Sometimes the action of finding out stuff is a very rewarding experience. I
don't know NE and don't have it, but I was very interested to see why
Jimmy's gallant attempt didn't work. It took me minutes to find what I
needed on the web, and identify what the major differences are in accessing
COM servers from Fujitsu and MF.

Having access to COM is a MAJOR feature of using OO. It seems that NE
implements it just as well (although a little differently) as Fujitsu does.
I hope some of you NE people are moved to try accessing some of the COM
components that already exist on your systems...Sometimes these components
are referred to as "Automation servers" They include things like ACCESS,
Excel, Powerpoint, and MS Word, all easily accessible from your COBOL, as
Automation or COM/OLE servers.

Once everyone is happy with ACCESSING a web service from COBOL, the next
step is to BUILD one in COBOL. One way is to take a COM component, wrap it
in the required SOAP/XML, generate the WSDL, and post it on a server. Or, as
in the case of AVS above, write a C# web service that wraps a COBOL COM
component, and let VS 2005 generate all the WSDL, XML, and SOAP.

Today, if I was writing AVS again, I'd do it in C#, but at the time I
started it, I was only just considering C# so I wrote the engine as a COBOL
COM server instead. Notice that this component based approach has meant that
even though I move away from COBOL, my COBOL legacy is still viable. BECAUSE
it is a COM server it can be easily wrapped and handled by C# as "unmanaged"
code in a web service. And it can be accessed in any language from anywhere
on any platform that supports web services. Alternatively, it can be dropped
as a COM component onto a web page or a desktop application and accessed
locally as a COM object, or remotely over DCOM+ using RPC. (Web services are
obsoleting this particular use of COM servers; they are more secure than
DCOM+ and generally more stable.)

Encapsulating functionality into components makes as much sense today as it
did 10 years ago. There are numerous spin offs from doing so.

Pete.


From: Charles Hottel on

"Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> wrote in message
news:5beo1dF2s776oU1(a)mid.individual.net...
>
<snip>

> Speaking of reading... I am working my way through "The Singularity is
> Near" as you recommended. I find it stimulating and interesting. Will
> post my overall impressions when I've finished it. At 20 minutes a night,
> it may be some time...:-)
>
Good I am glad that you are enjoying it.


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: Microfocus Cobol "SLEEP" routine
Next: Help with Tcal