Web Service Requests

SOAP/AM Client Development > Accessing a Web Service > Calling a Web Service Method >

Web Service Requests

Previous pageReturn to chapter overviewNext page

In order to invoke a Web service method, the IPM must be formatted appropriately and sent to the SOAP/AM Client Process (SOAPAMCP) using whatever interprocess communications mechanism is appropriate (e.g. the "SEND" verb or WRITEREAD or SERVERCLASS_SEND_ Guardian System Procedures) for your application.

 

The format of Web service requests have a similar structure regardless of what service or method is being accessed. Every request IPM has the following header:

 

DEF soapam-rq-hdr.                                                            

 02 message-code                        TYPE BINARY 16.                      

 02 reserved                            TYPE CHARACTER 30.                    

END.

 

This message-code element must be initialized with the message code value associated with the method you want to invoke. The reserved field should be initialized to 0.

Arrays

When the WSDL2CDF utility creates a type definitions in the Client Definition File (CDF), it inserts a 'depends on' element for every array. Your application must set the 'depends on' element to the number of valid entries in the array.

Example

A COBOL example of an echo string service request is shown below. The echoString service is a SOAP/AM sample service that is available on the SOAP/AM demo server.

 

WORKING-STORAGE.

 

01 MESSAGE-CODE-VALUES.                                                      

 02 MC-ECHOSTRING     NATIVE-2       VALUE 101.                                

 

01 RQ-ECHOSTRING.                                                            

 02 SOAPAM-RQ-HDR.                                                          

   03 MESSAGE-CODE                NATIVE-2.                                

   03 RESERVED                    PIC X(30).                                

 02 ECHOSTRING.                                                            

   03 INPUTSTRING                 PIC X(32).  

                           

   01 RP-ECHOSTRING.                                                            

     02 SOAPAM-RP-HDR.                                                          

       03 REPLY-CODE                  NATIVE-2.                                

       03 INFO-CODE                   NATIVE-2.                                

       03 INFO-DETAIL                 NATIVE-2.                                

       03 RESERVED                    PIC X(26).                                

     02 ECHOSTRINGRESPONSE.                                                    

       03 RETURNZ                     PIC X(32).                                

 

. . .

 

PROCEDURE-DIVISION.

 

MOVE LOW-VALUES TO SOAPAM-RQ-HDR OF RQ-ECHOSTRING.

MOVE MC-ECHOSTRING TO MESSAGE-CODE OF RQ-ECHOSTRING.

MOVE "Hello world!" TO INPUTSTRING OF RQ-ECHOSTRING.

 

SEND RQ-ECHOSTRING TO "ECHO-SERVICE"

REPLY CODE 0,1 YIELDS RP-ECHOSTRING

     CODE OTHER YIELDS SOAPAM-REPLY.

 

IF REPLY-CODE OF SOAPAM-RP-HDR OF RP-ECHOSTRING = 0

DISPLAY RETURNZ OF RP-ECHOSTRING.