Trading Networks 10.3 | Administering and Monitoring B2B Transactions | Service Development Help | Building C/C++ Services | Generating Code a C/C++ Service Can Use to Invoke a Specified Service
 
Generating Code a C/C++ Service Can Use to Invoke a Specified Service
You can have Designer generate the code that invokes a selected service, which you can then add to a C/C++ service. Designer generates code that:
*Creates a Values object based on the service’s declared input parameters
*Invokes the selected service passing it the Values object and catching exceptions
*Retrieves the returned Values object from the selected service
*Uses the key/value pairs in the returned Values object to assign variables based on the declared output parameters of the selected service
You do not have to generate code for all the input and output parameters. You can select to generate code for only the input parameters, only the output parameters, or you can select one or more input/output parameters for which to generate code.
When Designer generates code from the service input/output parameters, it puts the code on the clipboard. From there, you can paste it into a C/C++ service and modify it as necessary.
*To generate code to invoke a service
1. In the Package Navigator view, open the service that you want to invoke.
2. If you want to generate code for a subset of the input/output parameters, on the Input/Output tab, select the parameters for which you want to generate code. To select more than one variable, press the CTRL key as you select parameters.
3. In the editor, right click the service to view the context menu, and select Generate Code.
4. In the Code Generation window, select For calling this service from another service and click Next.
5. For Specification, select the Input and/or Output check boxes to reflect the parameters for which you want to generate code.
6. For Which Fields? select one of the following:
*All Fields if you want to generate code for all of the parameters identified by your Specification selection.
*Selected Fields if you want to generate code for only the parameters you selected before starting the code generation.
7. Click Finish. Designer generates code and places it on the clipboard.
8. Paste the contents of the clipboard into a C/C++ service.