[Migrated content. Thread originally posted on 18 November 2011]
Hello,
I am trying to figure out how to replicate this program based on a RM/COBOL example in Visual COBOL: identification division.
program-id. RMNetTest.
data division.
working-storage section.
01 prservices2.
02 men-mensaje pic x(30) value "texto del mensaje".
01 request-payload usage pointer.
01 response-payload usage pointer.
01 response-error usage pointer.
01 response-status pic 9(3) value zero.
01 response-len pic s9(4).
01 a-single-char pic x.
01 longrequest.
02 filler pic x occurs 1 to 65000
times depending on counters.
01 counters pic 9(5).
01 Returned-text pic x(1031).
78 Desired-SOAPAction value 'SOAPAction' & x"00" &
'"tempuri.org/.../message"' & x"00".
78 Post-Address value
"desawflow.mango.com/.../tc".
78 ContentType value "text/xml; charset=utf-8".
Copy "lixmlall.cpy".
linkage section.
01 http-response pic x.
01 http-error pic x.
procedure division.
a.
display "Liant RMNet Test"
line 1 position 10 erase.
xml initialize.
if not xml-ok then
display "error inicializando xml"
stop run
end-if
XML INITIALIZE
XML EXPORT TEXT
prservices2
request-payload
"/MNG/EXPL/XML/prservices2"
"/MNG/EXPL/XML/prservices2pl.xsl".
if not XML-OK then
display "error export text"
stop run
end-if.
call "NetInit" giving response-status.
if not response-status = 0
display "Error NetInit! ", response-status
call "NetGetError" giving response-error
set address of http-error to response-error
display "Error message: ", http-error(1:)
stop run
end-if.
display "call netsetsslca".
call "NetSetSSLCA" using "cert_desa_ipsCA_root.pem".
display "httpsetcookiefile".
call "HttpSetCookieFile" giving response-status.
if not response-status = 0
display "Error HttpSetCookieFile! ", response-status
call "NetGetError" giving response-error
set address of http-error to response-error
display "Error message: ", http-error(1:)
stop run
end-if.
perform b.
XML TERMINATE.
Stop Run.
b.
set response-payload to address of Returned-text.
display "httphost".
call "HttpPost" using
Post-Address
ContentType
request-payload
response-payload
Desired-SOAPAction
giving
response-status.
if not response-status = 0
display "Error HttpPost! ", response-status
call "NetGetError" giving response-error
set address of http-error to response-error
display "Error message: ", http-error(1:)
stop run
end-if.
* set address of http-response to response-payload.
display "Response: ", response-status.
if response-payload = NULL
display "Error: NULL pointer returned", line 10, blink
accept a-single-char prompt
stop run
end-if.
xml put text
response-payload
"/MNG/EXPL/TMP/XML/respuesta2".
if not xml-ok then
display "error en xml"
stop run
end-if.
call "NetFree" using response-payload.
The template that I am using to communicate with the web service is like this:<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="www.w3.org/.../Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../" xmlns:ns0="tc" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance">
<soapenv:Body>
<ns0:echo>
<message soapenv:encodingStyle='schemas.xmlsoap.org/.../' xsi:type='xsd:string'>
<xsl:value-of select="prservices2/men-mensaje"/>
</message>
</ns0:echo>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
I suppose I have to use 'System.Xml' in the way you will do it when you are working with C#. But... after that? What is the equivalent to 'call "NetInit"', 'call "NetSetSSLCA"', 'call "HttpSetCookieFile"', and so on?
Thank you