Consuming a Web Service from Natural

For those of you who do not want to follow all the steps in Peter Leibl’s excellent article on calling a Web Service from Natural in the current edition of the TECHniques newsletter here are the programs all zipped up and ready to go.
weather.zip (3.82 KB)

Interesting for us!

But I guess you have to use Natural 6.2 and we’re currently on 6.1. :frowning:

Hello Stephen,
I’ve tried to call the Web Service with your small program - it doesn’t work!
We’re working with Natural 6.1.1 PL 22 on Windows 2000. I’ve Internet access. We’ve different User-Ids for SPoD and Internet-Access, but you can provide an User and a password with the “Request document” command. So the authority should be no problem.
But I get always Http-Errors: first http-error 407 and if i try it again http-error 500 (internal server error).
What can be the problem? Maybe the firewall?

And another question to the xml-“code”: what about lower- and uppercase? I generate the subprograms with the xml-toolkit on unix because it’s not installed on windows. And all tags/values are in uppercases. In the program weather the examine replaces “” with a longer string. But “” isn’t recognized. I changes the examine. But it still doesn’t work.

Can you give me a hint?

Tristan

I developed and tested this under Natural 6.2.

I must admit that I did cheat a bit with the parser and serializer sub-routines :oops: As you say, when you generate them using the XML toolkit from a PDA everything ends up in upper case, so I had to go in a change all the text constants to match what is in the WSDL. You have to do this in both the serialiser and parser, which come to think of it, may be the reason for your connect error as well.

Now does it work! :lol:

I did it as you do: all text constants in the subprograms must be in Upper- and lowercases as in the wdsl.
then it’s always good to make no typemismatches!

I’ve changed the examine statement for substituting the quotes in double-quotes:
define data local
0240 1 #HK (A1) CONST<H’27’> /* Hochkomma ’
0250 1 #GF (A1) CONST<H’22’> /* G

Following a discussion on SAG-L, I will attempt to do this using mainframe Natural. I’ve sucessfully stowed the programs and am now trying to get them to work, so watch this space for results…

OK, I’ve now got this working on the mainframe using NAT42; what I did was to connect to a NDV server from my Natural on Windows (SPod) using the following parameters: XML=(ON,RDOC=ON,PARSE=ON,RDP=’’,RDNOP=’’,RDPPORT=8080),CFICU=ON,CP=AUTO

I then copied the programs over and they work fine.

I did not follow the whole thread, but to forbid Natural to translate double quotes you can use OPTIONS TQMARK=OFF in (all) your programs. So you don’t have to replace the single quotes with double quotes.

:slight_smile: I instasll this code on natural 611 xp and it’s running already.
On natural 422 z/OS we make the installation for parse and request document, but at this time we receive an error:
NAT8304 HTTP request failed. Reason OPEN : Unexpected internal error condition.
We are in contact with SAG to resolved this problem.
Thanks for the code, Bernard Grandjean BIT.

Bernard,

Did you ever get a response to the Nat8304 error on the Request Document statement? I am having that problem when trying to access a web service I’ve created on my server. The weather program (included in the literature) works fine, but beyond that, no response to anything else.

gtb

Search Servline24 Knowledge Base for “NAT8304”. There are several fixes prior to NAT423 and some parameters settings that can cause this error - particularly the proxy and port settings.