Some weeks ago my friend, Christine, made me aware about the vehicle identification number, aka the VIN.
Naturally, I had to go and check for some VIN-related web services and looks I was lucky to find one that can be tested in some minutes: vinaudit.com.

It looks that vinaudit.com will give you the chance to test their web service based on some specific demo key and the output can be an xml or a json one. Of course, I used the xml output option.
Update 2019: The demo key to test this web service was disabled. However, you can still follow this tutorial to implement the same pattern when using an authentication key for a web service.
The first test done was using the SOAP UI:
Note: To use the vinaudit.com we need the below main details + a relevant VIN code:
- Endpoint: http://specifications.vinaudit.com
- Resource: /getspecifications.php
- Parameters: ?key=VA_DEMO_KEY&format=xml&vin=*****
For a demo VIN code we can use the randomvin.com.
The below Oracle SOA Suite 12c demo SCA composite will help you to expose this vinaudit.com REST service as a SOAP web service and ...
- the new service interface will not ask to the format + key details since such details will be embedded in the future SOA composite.
- the last 3 tags [InvoicePrice, DeliveryCharges, MSRP] will show only the specific number and will not include the currency.
For this future SOA composite we need the below XML schemas:
- vin_Audit_result.xsd
- VIN_ONLY_Input.xsd
- VIN_Response.xsd
- VIN demo code for tests based on randomvin.com
Open the JDeveloper 12c and create a new SOA application and SOA project:
For the composite External Reference we will use the REST option:
Keep in mind how the REST API looks like for the vinaudit.com service:
To make sure in the future we invoke this service on a SOAP based pattern, enable the first checkbox:
Like in the SOAP UI tool, use the http://specifications.vinaudit.com as the main URL:
Like in the SOAP UI tool, use the /getspecifications.php for the resource
Once all done, the next focus is on the IN and OUT parameters. Of course, the REST GET method will be used.

For the IN [aka the Request] we will use 2 different approaches:
- we will import the VIN input schema [VIN_ONLY_Input.xsd] that has only the VIN parameter. At the end this is also what the future user should provide to consume the service.
- Manually, we will define the format + key parameters with the default value. However, future users will not be asked about the format + key parameters since the default embedded values will be used.
- key
- VA_DEMO_KEY
- $msg.request/key
- format
- xml
- $msg.request/format
All done with the IN details. Now we go with the OUT [aka the Response ]
For the Response OUT we will use the vin_Audit_result.xsd XML schema based on the vinaudit.com xml output.

All done... OK and Finish:
We have the external reference; now we need to add a Bpel Component that will be exposed as a SOAP/WSDL service.

We will use the same schema for the INPUT but a different one for the OUTPUT...
For the composite output we will use the VIN_Response.xsd schema.
Once the new Bpel component was created we need to link it with the REST reference:

Inside the Bpel we will go with the very basic and simple Bpel pattern + something extra:
- an Invoke activity. Here we will also define the IN and OUT internal variables.
- The first Assign activity to assign the User input to the REST service
- The second Assign activity to assign the REST service to the Bpel/user OUT response. Here we will also need to remove the first character [that points to the currency symbol] from the REST output for the InvoicePrice, DeliveryCharges, MSRP xml elements.


The first assign is a very simple and basic one: the IN from the Bpel client/the future user will be assigned to the IN variable for the REST service; what the future customer/user will submit will be used as the REST IN data:
For the second assign we will use the basic drag and drop pattern for all the xml elements with the same name and we will stop once we see the last 3 elements [InvoicePrice, DeliveryCharges, MSRP].
Since we need to remove the first character from the default InvoicePrice, DeliveryCharges, MSRP output we will need the "substring" function.
Keep in mind that in SOA we start to count not from 0 but from 1.
Link the function to the specific OUT element...

OK, close and save the project and deploy it.

Now we can test it and this time is enough to add only the VIN as the IN parameter...
Go back to the vinaudit.com SOAP UI test and check the last 3 xml tags:
We now have a SOA SCA composite that can be also tested with SOAP UI or even included in some other external applications:
From here we will invoke this new composite by providing only the VIN code and the output will show no more the currency symbol for the last 3 elements [InvoicePrice, DeliveryCharges, MSRP].