Wednesday, July 08, 2020

How to expose WSDL as webservice using ApacheAxis2

Lets assume we have a WSDL file called as AreaService.wsdl
1:- AreaService.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/AreaService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AreaService" targetNamespace="http://tempuri.org/AreaService/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/AreaService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="area" type="xsd:float"/>
<xsd:element name="parameters" type="tns:dimensions"/>
<xsd:complexType name="dimensions">
<xsd:sequence>
<xsd:element name="width" type="xsd:float"></xsd:element>
<xsd:element name="height" type="xsd:float"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="CalculateRectAreaResponse">
<wsdl:part element="tns:area" name="area"/>
</wsdl:message>
<wsdl:message name="CalculateRectAreaRequest">
<wsdl:part element="tns:parameters" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AreaService">
<wsdl:operation name="CalculateRectArea">
<wsdl:input message="tns:CalculateRectAreaRequest"/>
<wsdl:output message="tns:CalculateRectAreaResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AreaServiceSOAP" type="tns:AreaService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="CalculateRectArea">
<soap:operation soapAction="http://tempuri.org/AreaService/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AreaService">
<wsdl:port binding="tns:AreaServiceSOAP" name="AreaServiceSOAP">
<soap:address location="http://tempuri.org"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Follow below given step to expose this wsdl file as SOAP W/S using Apache Axis2.
Make sure you have WTP and Axis plug in Eclipse and also have Axis2 set up in your machine.
1- Create Dynamic Project
Image1Image2
Click on Modify and select Axis2
Image3
Click save and next
Image4Image5
Click on Finish Button.
Now create new folder wsdl as shown below
Image6
and click finish button.
Copy your wsdl in this wsdl folder
Now lets exposed this wsdl as webservice using following steps given below
Right Click on WSDL file --> Other --> Web Service--> Web Service

Image7Image8Image9.1
Click on web service runtime:Apache Axis2

Image9Image10Image11
Click on start server button and wait for server to start

Image12

Now modify the response of the code generated from the wsdl so that we can get the desired output in this case we have file called AreaServiceSkeleton.java
Area objArea = new Area();
objArea.setArea(parameters.getParameters().getHeight()*parameters.getParameters().getWidth());
return objArea;
//throw new java.lang.UnsupportedOperationException("Please implement " + this.getClass().getName() + "#calculateRectArea");
Image13

Now deploy the applicaiton on the server i.e. right click the project and select run as and tomcat and next and deploy
Now lets check our WSDL files exposed using this url
Image14.1Image14
Click on service
Image15
Now if you hover your mouser cursor on AreaService you will get the WSDL url copy it
http://localhost:8181/SiddhuExposedWsdl/services/AreaService?wsdl
We will use this to check if the service is working or not. To test the SOAP WS we are using SOAP UI tool
Image18Image19Image20

Wednesday, July 01, 2020

GDPR using Sourcepoint

Sourcepoint – Sourcepoint’s Consent Management Platform (CMP) provides website publishers with a flexible way to develop and deploy consent messages in a matter of minutes. The Sourcepoint consent tool grows with you as your needs evolve, from deploying simple consent messages to designing sophisticated user experiences quickly and easily. Watch the video tutorial below to learn how you can set up Sourcepoint on your site.
As we do not have any personal site running on the internet I am using given site to create one blogger site for me and best part is it is FREE :)
https://www.blogger.com/
Let say the name of the site is siddharathahdhumale.blogspot.com
By default you will be able to see the below screen

Image1

Now lets create our GDPR external script snippet using
https://app.sourcepoint.com/
Fill the information provided below screen

Image2


Image3Image8

Click Next

Image4
Make all the toggle enable so that we get better user experience.
Click Next
Image5


Make sure to click toggle on so that it will be available for the end users.
Thats it we generated the snippete code using sourcepointthat can be easily used for GDPR. This snippet code can be direcly appended in out hmtl file
as show below.
In our blog https://siddharathahdhumale.blogspot.com/ in sidebar button https://www.blogger.com/blog/layout/ as shown below click on the Add a gadget


Image6

Now click on HTML/JAVAScript as shown below

Image7
After that add the generated code snippet using source point and save it.

Lets go to your site https://siddharathahdhumale.blogspot.com/ and do hard refresh it.

Image9

If you click on show purpose

Image10


Note:-
1- TO create this you will need google account. Use your valid google account to create the same.
2- TO add external Script into the site make sure to go to layout of the blogger
https://www.blogger.com/blog/layout