Web services example

JCICS supports all the API commands that are available for working with web services in an application.

Methods JCICS class EXEC CICS commands
invoke() WebService INVOKE WEBSERVICE
create() SoapFault SOAPFAULT CREATE
addFaultString() SoapFault SOAPFAULT ADD FAULTSTRING
addSubCode() SoapFault SOAPFAULT ADD SUBCODESTR
delete() SoapFault SOAPFAULT DELETE
create() WSAEpr WSAEPR CREATE
delete() WSAContext WSACONTEXT DELETE
set*() WSAContext WSACONTEXT BUILD
get*() WSAContext WSACONTEXT GET

The following example shows how you might use JCICS to create a web service request:

Channel requesterChannel = Task.getTask().createChannel("TestRequester");
                    Container appData = requesterChannel.createContainer("DFHWS-DATA");
                    byte[] exampleData = "ExampleData".getBytes();
                    appData.put(exampleData);                
                    
                    WebService requester = new WebService();
                    requester.setName("MyWebservice");
                    requester.invoke(requesterChannel, "myOperationName");

                    byte[] response = appData.get();

To handle the application data that is sent and received in a web service request, you can use a tool such as JZOS to generate classes for you if you are working with structured data. For more information, see Interacting with structured data from Java. You can also use Java to generate and consume XML directly.