Hi Jojo,

*addPoli*cy is a void method[1]. Hence you can expect only following
success SOAP response as the output.

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Body>      <ns:addPolicyResponse
xmlns:ns="http://org.apache.axis2/xsd";>         <ns:return
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
     </ns:addPolicyResponse>   </soapenv:Body></soapenv:Envelope>


If this policy is not added successfully It will give an error as shown below.

Error scenario 1: Duplicate policy


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>An Entitlement Policy with the given Id already
exists</faultstring>
         <detail>
            <ns:EntitlementPolicyAdminServiceEntitlementException
xmlns:ns="http://org.apache.axis2/xsd";>
               <EntitlementException
xsi:type="ax2346:EntitlementException"
xmlns="http://org.apache.axis2/xsd";
xmlns:ax2344="http://dto.entitlement.identity.carbon.wso2.org/xsd";
xmlns:ax2346="http://entitlement.identity.carbon.wso2.org/xsd";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
                  <ax2346:message>An Entitlement Policy with the given
Id already exists</ax2346:message>
               </EntitlementException>
            </ns:EntitlementPolicyAdminServiceEntitlementException>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Error scenario 2: Invalid policy

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>Invalid Entitlement Policy. Policy is not valid
according to XACML schema</faultstring>
         <detail>
            <ns:EntitlementPolicyAdminServiceEntitlementException
xmlns:ns="http://org.apache.axis2/xsd";>
               <EntitlementException
xsi:type="ax2346:EntitlementException"
xmlns="http://org.apache.axis2/xsd";
xmlns:ax2344="http://dto.entitlement.identity.carbon.wso2.org/xsd";
xmlns:ax2346="http://entitlement.identity.carbon.wso2.org/xsd";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
                  <ax2346:message>Invalid Entitlement Policy. Policy
is not valid according to XACML schema</ax2346:message>
               </EntitlementException>
            </ns:EntitlementPolicyAdminServiceEntitlementException>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Furthermore, you can do a getPolicy to  double check if you want.
Hope this is what you are looking for. Please let me know if you need
further assistance on this


[1]
https://github.com/wso2/carbon-identity-framework/blob/326c0f808a5d64b59cf9e7489a09a935b1c7a8f1/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/EntitlementPolicyAdminService.java#L75

Thank you,
Dinali



On Thu, Nov 21, 2019 at 12:00 PM Jojo Paderes <[email protected]>
wrote:

> Hi,
>
> I'm reading through the documentation of WSO2 Identity Server's
> Entitlement API on how to use the SOAP web service API for adding an
> entitlement policy:
>
> https://is.docs.wso2.com/en/5.9.0/develop/entitlement-with-apis/
>
> From the WSDL reosurce provided in the document, I can see that the
> addPolicy XSD element is present:
>
> <xs:element name="addPolicy">
>     <xs:complexType>
>         <xs:sequence>
>             <xs:element minOccurs="0" name="policyDTO" nillable="true" 
> type="ax2346:PolicyDTO"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:element>
>
> but I couldn't find the schema element for the addPolicyResponse. Without
> this information the web service client is unable to understand the web
> service response for adding a policy.
>
> My question is where I can find the XSD element for the addPolicyResponse?
>
>
> Thanks!
>
> - Jojo
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
*Dinali Rosemin Dabarera*
Senior Software Engineer
IAM Domain
WSO2 Lanka (pvt) Ltd.
Web: http://wso2.com/
Email : [email protected]
LinkedIn <https://lk.linkedin.com/in/dinalidabarera>
Mobile: +94770198933




<https://lk.linkedin.com/in/dinalidabarera>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to