Skip to main content

Hi

I need help creating a server program running under Xcentricity BIS that:

- Receives a POST message from a client fx Postman.
- Reads the header
- Saves the body received to a file - og pass the body to a sub-program.
- Call a sub-program that reads the body and creates a reply in a file
- The server program reads the reply from the file and sends the data to the client

We already have this program, using C$SOCKET – so we need another program doing the same with xbis.

Hi

I need help creating a server program running under Xcentricity BIS that:

- Receives a POST message from a client fx Postman.
- Reads the header
- Saves the body received to a file - og pass the body to a sub-program.
- Call a sub-program that reads the body and creates a reply in a file
- The server program reads the reply from the file and sends the data to the client

We already have this program, using C$SOCKET – so we need another program doing the same with xbis.

The sample\\rmnet\\tempconvert.cbl  example program shows how to process a POST


The sample\\rmnet\\tempconvert.cbl  example program shows how to process a POST

Hi  

Thank you for your reply. 

When I look at tempconvert.cbl it looks like the program is at client program sending a request to https://www.w3schools.com/xml/FahrenheitToCelsius and reading the reply.

It is not a server program receiving a POST request, and sending a reply.

I need to create the server program receiving the POST message.

Is this possible with tempconvert.cbl?

Regards Kim


Hi

I need help creating a server program running under Xcentricity BIS that:

- Receives a POST message from a client fx Postman.
- Reads the header
- Saves the body received to a file - og pass the body to a sub-program.
- Call a sub-program that reads the body and creates a reply in a file
- The server program reads the reply from the file and sends the data to the client

We already have this program, using C$SOCKET – so we need another program doing the same with xbis.

The Xcentrisity BIS for extend product ships with a tutorial, and samples, which can provide useful guidance in regards to creating a web service that handles HTTP POST requests:

Xcentrisity BIS Tutorial Introduction 

Create a simple SOAP/RPC web service using Xcenstrisity BIS 

 

**As a note; if you do not have Xcentrisity BIS for extend, then, your Micro Focus Sales Account Manager should be able to assist you with obtaining product, and, licensing.


The Xcentrisity BIS for extend product ships with a tutorial, and samples, which can provide useful guidance in regards to creating a web service that handles HTTP POST requests:

Xcentrisity BIS Tutorial Introduction 

Create a simple SOAP/RPC web service using Xcenstrisity BIS 

 

**As a note; if you do not have Xcentrisity BIS for extend, then, your Micro Focus Sales Account Manager should be able to assist you with obtaining product, and, licensing.

Hi  

I already have Xcentricity BIS installed and running on my server. I have read the docs and tried the tutorials, but I can't find a tutorial or demo showing what I need. I have figuret out how to create the reply and send it to the client.

But I don't know how to receive the header body into two working-storrage fx:

 

01 w-request. 03 w-header PIC X(1000). 03 w-body PIC X(1000).

 

 In tutorial3 I can see that the request data is read using the following:

 

Call "B$ReadRequest" Giving BIS-Status. If Not BIS-OK Go To Z.

 

and is saved to a XML file. But the data received is not always XML, so I need to handle the data differently.

Maybe I need to change the .srf file so XML is not used? I can't find it in the docs on how to exchange other data than XML.

 

{{ // There must be no whitespace before the XML header, hence the newline-eating comment tags. }} {{ Handler * }}{{//}} {{ Trace(start,file,dir=%TEMP%,exchfiles) }}{{//}} {{ SetEnv(A_CONFIG=cblconfig.txt) }}{{//}} {{ ServiceLibs(xmlif) }}{{//}} {{ StartService(tutorial3.acu) }}{{//}} {{ XMLExchange }}

 

Regards Kim


Hi  

I already have Xcentricity BIS installed and running on my server. I have read the docs and tried the tutorials, but I can't find a tutorial or demo showing what I need. I have figuret out how to create the reply and send it to the client.

But I don't know how to receive the header body into two working-storrage fx:

 

01 w-request. 03 w-header PIC X(1000). 03 w-body PIC X(1000).

 

 In tutorial3 I can see that the request data is read using the following:

 

Call "B$ReadRequest" Giving BIS-Status. If Not BIS-OK Go To Z.

 

and is saved to a XML file. But the data received is not always XML, so I need to handle the data differently.

Maybe I need to change the .srf file so XML is not used? I can't find it in the docs on how to exchange other data than XML.

 

{{ // There must be no whitespace before the XML header, hence the newline-eating comment tags. }} {{ Handler * }}{{//}} {{ Trace(start,file,dir=%TEMP%,exchfiles) }}{{//}} {{ SetEnv(A_CONFIG=cblconfig.txt) }}{{//}} {{ ServiceLibs(xmlif) }}{{//}} {{ StartService(tutorial3.acu) }}{{//}} {{ XMLExchange }}

 

Regards Kim

Hi Kim:

XBIS always uses XML files to exchange data with COBOL.  

If the POST data is not XML, it will have a different content type -- the most common is

Content-Type: application/x-www-form-urlencoded


If the content type is already XML (like SOAP), BIS just passes it to the COBOL program.  If the content type is another recognized type, like above, BIS converts it to XML and passes it to the COBOL program.

I see you have tracing turned on -- the trace and the exchange file should show you what the generated XML looks like and the request should appear even if the COBOL program doesn't process it properly. 

If you aren't seeing the trace files, you may want to change "dir=%TEMP%" in the {TRACE} statement to specify a directory instead of an environment variable -- be sure it's writable by everyone.

But... based on this:

https://learning.postman.com/docs/sending-requests/requests/

It looks like POSTMAN supports SOAP requests.


Hi Kim:

XBIS always uses XML files to exchange data with COBOL.  

If the POST data is not XML, it will have a different content type -- the most common is

Content-Type: application/x-www-form-urlencoded


If the content type is already XML (like SOAP), BIS just passes it to the COBOL program.  If the content type is another recognized type, like above, BIS converts it to XML and passes it to the COBOL program.

I see you have tracing turned on -- the trace and the exchange file should show you what the generated XML looks like and the request should appear even if the COBOL program doesn't process it properly. 

If you aren't seeing the trace files, you may want to change "dir=%TEMP%" in the {TRACE} statement to specify a directory instead of an environment variable -- be sure it's writable by everyone.

But... based on this:

https://learning.postman.com/docs/sending-requests/requests/

It looks like POSTMAN supports SOAP requests.

Hi  

Thanks. I did not know that XBIS only supports XML. I do now

If I send a request with Content-type = application/xml, I can read the XML data in my program.
If I change to fx. text/plain, I receive a HTTP error 501 Not implemented.

I will continue working with application/xml for now

Regards Kim