Wednesday, 4 July 2018

How to Create Pega Soap Services

How To Create Pega Soap Service




Similar to Work and Data class there is an class Int in pega, we have to create all the integration related rules in Int class only.

Now in our example , we are going to create all integration related details in class(TGB-HRApps-Int


Now our requirement is , any External System will give CustomerID as input in Request to our application, then it should return Customer Details as Response.


I created 3 Classes under Int class.

In ServiceProvider Class I am going to create Two Single Page (Request and Response)
Request Mapped to class

Response Mapped to class

Now in ServiceProvider _Request Class I am going to create one property CustomerID , to store the value which is coming from external system through Connector.

Now class structure looks like

Now in ServiceProvider_Response I am going to create one Property to store CustomerName, in response we should return CustomerName to Connector.


Now I am going to Create Two More Classes to store Address and Policy Details.

After creating all the Properties in Address and Policy Class, Class Structure Looks like.

Now I am going to create Two Single Page to refer Address Class Details and Policy Class Details in Service Provider Response.

Now on expanding the Class ServiceProvider, u can see all the Properties we created.


Now We can Start Create Soap Service through Service Wizard.

U can open the Service Wizard from  Designer Studio-> Integration-> Service-> Service Wizard.

Wizard look likes the below image.

In Service Purpose I choose  Process Input and Output Data,  depend upon the requirement we have to choose the value.

Now according to Process Input and Output Data , we have to get the data through connector and we have to give response depend upon requirement.

In Service Type we have to choose Soap , because we are practicing Soap .

Then we have to give Next,

In this page, In Data Class we have to choose the class where all the properties are there , In Service Name we have to give the Service Name(The Name for our Soap Service i.e ProvideCustomerDetails) 

Then we have to click Next,

Here we have to select Use XML for data Mapping, In pege Input Properties we have to select what are all the properties  we are going to use for Input and in Page Output Properties we have to choose what are all the Properties used in Response.


These properties will come under Xml Stream Rule and Xml Parse Rule. we can see that later.

then we have to click next.
Here we have to give the RulesetName for best practice we have to give Int Ruleset(I gave HRAppsInt) . RulesetVersion(any version). Wizard will create all the rules under this ruleset and version.

If we have to create Configure a New Service Package  we have to Choose the Configure a New Service Package. If u already created the Service package u can choose Existing Service Package.

Then we have to click next,
if u want to authenticate the user  who are using ur Service we have to check here Require authentication , or else we can uncheck it.

then click next 
next page will show all the rules created.

Click Finish.. Now u can see all the rules pega created for u.


The link displayed in above Picture is the WSDL URL  , that is the end point url to access ur Soap Service.

Now I am searching the Soap Service, that I am created in Rule explorer under Integration Service-> Soap Services.



U can see the Ruleset is HRAppsInt , that we have gave.


Service Soap is a Instance , so it is not listed in any class.


Here u can see there is a Page Name (MyServicePage), If i am sending the Customer ID as request to my Soap Service , In Service I can access the CustomerID from the Page MyservicePage. 

Then u can see there is an Activity Name option- This is the activity automatically started by soap service. we have to do all the things in this activity only.

In the Request Tab, U can see the parse rule, that is we are parsing the data that is available in xml to our clipboard under the Respective Pages.
U can see the parse rule structure in below image.


How u can access the CustomerID in Your activity??????

the answer is under Clipboard Page of MyServicePage.Request.CustomerID

In Response Tab, U can see the XML Stream rule
On expanding this u can see the mapping of Property from our Clipboard to XML.



Now we will see the activity

This is the overall activity I created to return response to connector.


Here in first step I get the CustomerID from MyServicePage and Assign to a property for use in the activity.


In the Second Step I used an Obj-Browse to retrieve the records of the CustomerID in database which match with the CustomerID came from Requestor.

In the above Page I am assgining the returned result(CustomerName, CustomerCity, CustomerState) in clipboard to XML Stream.

This obj-Browse for retrieve PolicyID of Customer.

In above Pic, we are retrieving PolicyName by PolicyID.
Above Pic Shows the Pages and Classes I added to refer the Property.


We Finished Creating Service., Now we have to test the Service.

For Testing we have to run the Service , on run this pop up box will appear, here we have to select Supply Soap Request envelope

After Click that radio button, box containing xml program will come, 

Here Now i am giving the CustomerID as 1 for Testing and Click Execute.


If u have any doubt ask me :)

12 comments:

  1. In 1st step , what is that target property?
    Do we have to create that new property to save the data?
    And in obj save ..... The property after equal to is that same property that i am talking about?

    ReplyDelete
    Replies
    1. Hi,

      1st step property set is not required

      We can directly map the response page customerId in Obj-Browse.

      CustomerId property we have to create.

      Delete
    2. Please let me know in case not clarified.

      Delete
  2. Can you please send the Screen shots of Datatype and Records?

    ReplyDelete
    Replies
    1. Hi Friend to be frank I did this post 1 year before in a pega trail edition. I not have those rules now in my system.

      Delete
  3. Hi I am able to see the Values in the Tracer
    But i am not able see in the Tab where xml Answers are present

    ReplyDelete
    Replies
    1. If the response is setting properly in "Response" page then the values should display in in the output.

      If you need help, you can reply back, will try to found the issue.

      Thank you friend.

      Delete
    2. HI mate.Now i am able to get the output. No worries :). Can you make a upcoming post on XML STREAM AND PARSE XML DETAILED EXPLANATION how it works in pega , how can we do it manually. I have tried to understand by using different sources. I am not able to get it all. I saw your post you have been explaning in good way. So this my request. please consider it

      Delete
  4. Hi can you make the next post on "CONNECT_SOAP" please. Thanks in advacne

    ReplyDelete
  5. Can you please make post On XML STREAM AND PARSE XML DETAILED Explanation at prority please

    ReplyDelete
  6. Awesome work...Keep going

    ReplyDelete