How to make a SOAP call to the sample Insurance project

Posted by manat on 23-Dec-2013 03:31

Hi,

I've tried to invoke a SOAP call to the sample Insurance project provided by Corticon. The followings is my step:

  1. Import the project from C:\Program Files (x86)\Progress\Corticon 5.3\samples\Insurance into the Corticon Studio
  2. Run a rule test, iSample_risk_test.ert, successfully without any error
  3. Publish this Decision Service (iSample_policy_pricing.erf) into a Corticon Server through the Corticon Studio itself
  4. Generates the test case into SOAP as:

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SOAP-ENV:Body>
        <CorticonRequest xmlns="urn:Corticon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" decisionServiceName="InsertDecisionServiceName">
          <WorkDocuments>
            <Female_Customer id="Female_Customer_id_1">
              <age>40</age>
              <credit_score xsi:nil="true" />
              <gender>female</gender>
              <income xsi:nil="true" />
              <life_risk_rating xsi:nil="true" />
              <long_term_value xsi:nil="true" />
              <net_worth xsi:nil="true" />
              <real_estate_assets xsi:nil="true" />
              <name xsi:nil="true" />
              <smoker>false</smoker>
              <ssn xsi:nil="true" />
              <state_of_residence xsi:nil="true" />
              <breast_cancer_detected>false</breast_cancer_detected>
              <breast_cancer_in_family>false</breast_cancer_in_family>
            </Female_Customer>
          </WorkDocuments>
        </CorticonRequest>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

  5. Here is a response I've got:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
          <ns1:CorticonResponse decisionServiceName="LifeInsurance" xmlns="urn:Corticon" xmlns:ns1="urn:Corticon">
             <ns1:WorkDocuments>
                <ns1:Female_Customer id="Female_Customer_id_1">
                   <ns1:age>40</ns1:age>
                   <ns1:breast_cancer_detected>false</ns1:breast_cancer_detected>
                   <ns1:breast_cancer_in_family>false</ns1:breast_cancer_in_family>
                   <ns1:credit_score xsi:nil="true"/>
                   <ns1:gender>female</ns1:gender>
                   <ns1:income xsi:nil="true"/>
                   <ns1:life_risk_rating xsi:nil="true"/>
                   <ns1:long_term_value xsi:nil="true"/>
                   <ns1:name xsi:nil="true"/>
                   <ns1:net_worth xsi:nil="true"/>
                   <ns1:real_estate_assets xsi:nil="true"/>
                   <ns1:smoker>false</ns1:smoker>
                   <ns1:ssn xsi:nil="true"/>
                   <ns1:state_of_residence xsi:nil="true"/>
                </ns1:Female_Customer>
             </ns1:WorkDocuments>
             <ns1:Messages version="0.41">
                <ns1:Message>
                   <ns1:severity>Violation</ns1:severity>
                   <ns1:text>An unexpected error has occurred in Rule Asset: null</ns1:text>
                </ns1:Message>
             </ns1:Messages>
          </ns1:CorticonResponse>
       </soapenv:Body>
    </soapenv:Envelope>

The responded message indicated that something is wrong, but I do not know what is that. I didn't find any problem with this process when I tested with the sample Cargo.

I suspected that it is because there is only 1 rule sheet of Cargo rule flow. Meanwhile, Insurance rule flow have 5 rule sheets. Is this really the case? If so, how could I make a call on this scenario?


Thank you.

Posted by manat on 24-Dec-2013 05:33

I found the problem. The first rule sheet of iSample_policy_pricing.erf, Get Existing Policies appears to call an external system. When invoking the service, the first rulesheet is supposed to be invoked first, and that caused the problem.

All Replies

Posted by Jan Krishnamurthy on 23-Dec-2013 07:56

In the Corticon Request XML :

You have:

<CorticonRequest xmlns="urn:Corticon" xmlns:xsi="www.w3.org/.../XMLSchema-instance" decisionServiceName="InsertDecisionServiceName">

Please insert the name of the decision Service here :

Eg:

<CorticonRequest xmlns="urn:Corticon" xmlns:xsi="www.w3.org/.../XMLSchema-instance" decisionServiceName="Insurance">

Posted by manat on 23-Dec-2013 08:03

Sorry, I just pasted a wrong version of my input. In fact, if you put a wrong decisionServiceName, you'll get CcServerDecisionServiceNotRegisteredException which is informative enough.

My point is that even with the right decisionServiceName as Insurance, I still receive have that Violation message.

Any idea?

Posted by Jan Krishnamurthy on 23-Dec-2013 08:13

Did you test this in Studio, Do you get successful results ?

Posted by manat on 23-Dec-2013 08:24

Yes. It's from the sample project. When I run iSample_risk_test.ert, I got successful result.


However, if I run the test from Studio against the Server, I received the same error as I run on SoapUI.


Now you probably suspected that there is something wrong with the server. So here it is, I , I deployed it using Studio's publish features. And I didn't have any problem with another rule, Cargo. That's why I had a question about the Rule Flow.

But let me know if you have any idea. Also please let me know if you require other information to help clarify this.

Thank you

Posted by Jan Krishnamurthy on 23-Dec-2013 09:09

So , I understand you deployed ruleflow iSample_policy_pricing.erf to the server. And now you want to call this Decision service from server.

Your request should be :

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="schemas.xmlsoap.org/.../" xmlns:SOAP-ENC="schemas.xmlsoap.org/.../" xmlns:xsd="www.w3.org/.../XMLSchema">

 <SOAP-ENV:Body>

<CorticonRequest xmlns="urn:Corticon" xmlns:xsi="www.w3.org/.../XMLSchema-instance" decisionServiceName="iSample_policy_pricing">

 <WorkDocuments>

   <Application>

     <category>life</category>

     <coverage>250000</coverage>

     <applicant xsi:type="Female_Customer">

       <age>46</age>

       <breast_cancer_detected>false</breast_cancer_detected>

       <breast_cancer_in_family>false</breast_cancer_in_family>

       <income>90000</income>

       <long_term_value xsi:nil="true" />

       <name>Jill Hennesey</name>

       <net_worth>600000</net_worth>

       <real_estate_assets>450000</real_estate_assets>

       <smoker>false</smoker>

       <ssn>111-22-3333</ssn>

       <state_of_residence>CA</state_of_residence>

     </applicant>

   </Application>

 </WorkDocuments>

</CorticonRequest>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

i.e. the XML equivalent of the iSample_policy_pricing_test.ert

So if you want to just test iSample_risk_test.ers alone by creating a ruleflow you can do so. For this you need to create a ruleflow iSample_risk.erf ( pointing the the iSample_risk.ers) and deploy it to the server.

Then create an XML equivalent (SOAP request)  of iSample_risk_test.ert and test it.

Posted by Jan Krishnamurthy on 23-Dec-2013 09:23

Sample Request for iSample_risk.erf

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="schemas.xmlsoap.org/.../" xmlns:SOAP-ENC="schemas.xmlsoap.org/.../" xmlns:xsd="www.w3.org/.../XMLSchema">

 <SOAP-ENV:Body>

   <CorticonRequest xmlns="urn:Corticon" xmlns:xsi="www.w3.org/.../XMLSchema-instance" decisionServiceName="iSample_risk">

     <WorkDocuments>

       <Female_Customer id="Female_Customer_id_1">

         <age>40</age>

         <credit_score xsi:nil="true" />

         <gender>female</gender>

         <income xsi:nil="true" />

         <life_risk_rating xsi:nil="true" />

         <long_term_value xsi:nil="true" />

         <net_worth xsi:nil="true" />

         <real_estate_assets xsi:nil="true" />

         <name xsi:nil="true" />

         <smoker>false</smoker>

         <ssn xsi:nil="true" />

         <state_of_residence xsi:nil="true" />

         <breast_cancer_detected>false</breast_cancer_detected>

         <breast_cancer_in_family>false</breast_cancer_in_family>

       </Female_Customer>

     </WorkDocuments>

   </CorticonRequest>

 </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Response for the request:

<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance">

  <soapenv:Body>

     <ns1:CorticonResponse decisionServiceName="iSample_risk" xmlns="urn:Corticon" xmlns:ns1="urn:Corticon">

        <ns1:WorkDocuments>

           <ns1:Female_Customer id="Female_Customer_id_1">

              <ns1:age>40</ns1:age>

              <ns1:breast_cancer_detected>false</ns1:breast_cancer_detected>

              <ns1:breast_cancer_in_family>false</ns1:breast_cancer_in_family>

              <ns1:credit_score xsi:nil="true"/>

              <ns1:gender>female</ns1:gender>

              <ns1:health_risk_rating>7</ns1:health_risk_rating>

              <ns1:income xsi:nil="true"/>

              <ns1:life_risk_rating>3</ns1:life_risk_rating>

              <ns1:long_term_value xsi:nil="true"/>

              <ns1:name xsi:nil="true"/>

              <ns1:net_worth xsi:nil="true"/>

              <ns1:real_estate_assets xsi:nil="true"/>

              <ns1:smoker>false</ns1:smoker>

              <ns1:ssn xsi:nil="true"/>

              <ns1:state_of_residence xsi:nil="true"/>

           </ns1:Female_Customer>

        </ns1:WorkDocuments>

        <ns1:Messages version="1.0">

           <ns1:Message>

              <ns1:severity>Info</ns1:severity>

              <ns1:text>Customers who have not been diagnosed with cancer and their relatives have not been diagnosed with cancer are deemed to be health risk rating of Good.</ns1:text>

              <ns1:entityReference href="#Female_Customer_id_1"/>

           </ns1:Message>

           <ns1:Message>

              <ns1:severity>Info</ns1:severity>

              <ns1:text>Applicants older than 30 have a life expectancy risk of Medium.</ns1:text>

              <ns1:entityReference href="#Female_Customer_id_1"/>

           </ns1:Message>

        </ns1:Messages>

     </ns1:CorticonResponse>

  </soapenv:Body>

</soapenv:Envelope>

Posted by manat on 23-Dec-2013 12:56

I changed the request to be what you suggested for (iSample_policy_pricing_test.ert), and no it doesn't work.

Posted by Jan Krishnamurthy on 23-Dec-2013 13:52

Can you please share your request XML and WSDL used

Posted by manat on 24-Dec-2013 05:33

I found the problem. The first rule sheet of iSample_policy_pricing.erf, Get Existing Policies appears to call an external system. When invoking the service, the first rulesheet is supposed to be invoked first, and that caused the problem.

This thread is closed