Enabling C4C Utility Web Service Call to IS-U (ERP) – Part 2
In part 1, the Business Object and Screen was created. Here we wil implement the call to the web service.
The logic we are going to use, is that we in C4C have an event that is called before save. When the user will enter the data and then clicking ‘Save’ a call to the web service is performed – the id of the Connection Object and Premise is returned by the web service, and all is stored in the business object we created.
In order to implement the service, we need to:
- Have the WSDL for the service.
- This is the WSDL we saved the URL for in the first blog – if you do not remember, then just go here.
- The name of the communication arrangement in C4C.
Let’s begin implementing in the SDK.
Implementing the Web Service
First right click on our project and select .Add -> New Item’.
On the list displayed select – ‘External Web Service Integration’, give it a name and select ‘Add’.
The SDK automatically suggest a name for the Communication Scenario, we need this when we perform the configuration in C4C later, just make sure you note down the name for later use.
Also – Change the setting to ‘Application Integration’.
Then click ‘Next’.
On the below screen there is no need for any changes. We see that it already list the one service operation we have.
Now click ‘Finish’.
You are then brought back here – OBS – the below view has a file extension of ‘.csd’ – this is the setting for the Communication Scenario.
Here you again have to select ‘Application Integration’ (1).
Next – see there is a tab for ‘Services’ click this TAB.
You then find the service under ‘Custom Outbound Services’.
Select this and then ‘Save and Activate”.
The web service is now implemented in the SDK. In order for it to be used, we to:
- Configure C4C to handle the communocation
- Implement code in the SDK to call the web service from our project.
Configure C4C to handle the communication.
Before implementing the final code, we will perform this configuration because we need information from this configuration in our code later.
To configure communication in C4C, we need the following 3 things:
- Communication System:
- This is the link between the C4C tenant and IS-U, will already be available as we are working in a system where integration is already running.
- Communication Scenario:
- We created this from the SDK above, this will also be in place.
- Communication Arrangement
- Here we link the Communication Scenario and the Communication System together.
- The name of the communication arrangement is required in our code later.
Since 1) and 2) above is already done, we will go directly to the Communication Arrangement creation.
You will need to logon to C4C and go to the ‘Administration’ work center. Here you select ‘Communication Arrangement’.
THIS IS A WORKAROUND
There is a couple of data points I did not know where to get, except from looking at the services already implemented. On the list of Communication Arrangement I opened the service configured for ‘MOVEINOUT’.
BE AWARE – We want to go into edit mode, and you do this by selecting the line (NOT THE LINK) and then choose ‘Edit’.
This will open the the following view. Here we can note down the Communication System, we will need this when creating our own Communication Arrangement.
Then select the tab ‘Technical Data’.
In this view click the button ‘Edit Advanced Settings’.
This will open up the following view:
The 2 things we need from here is:
- The Port number – in this case ‘44320’
- The part of the path INFRONT of ‘XISOAP…’ – in this case ‘/vlm23387’
With this we are ready to configure a new Communication Arrangement. Cancel out and do not save anything for this service.
Go to Communication Arrangement and click on ‘New’ – this will start wizard:
First we need to select the Communication Scenario. Here we already find the one we created via the SDK.
Then select ‘Next’.
On the above screen we enter the Communication System. We have that from the service we analyzed before. Then click ‘Next’ and then as we did when analyzing the service click on ‘Edit Advanced Settings’.
Here we need to enter the ‘Port’ – the one we found above.
The URL for the path should be provided by the PI consultant. The URL can be found by selecting the ‘Display WSDL’ from the sender agreement in PI.
Copy this URL from the point starting ‘XISOAP…’ .
Now copy this in to a text editor and remove all the ‘amp’ parameters from this URL. So if you as an example this in the URL – “senderService=CfC_ERP_UTIL&”, change this to – “senderService=CfC_ERP_UTIL&”. You will find ‘amp’ several times in the URL.
After this then add the start of the path we found for the MoveInOut service – in our case ‘/vlm23387’ in front of the modified URL. This would result in the URL now starting like “/vlm23387/XISOAP….” – this is the URL we copy in to the ‘Path’ field in C4C.
Then click on the ‘Check Service’ button. If your configuration is OK – you should see the following message at the bottom of the view:
Now it is time to go back to the SDK and call the web service. Remember that we need to have the name of the Communication Arrangement when we implement the service. This is covered in Part 3.