<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to avoid policy error when calling SOAP Webservices</title><link>https://answers.axonivy.com/questions/3185/how-to-avoid-policy-error-when-calling-soap-webservices</link><description>&lt;p&gt;I'm integrating data from a  remote SAP system over SOAP services. The SAP services WSDL contains &lt;code&gt;Policy&lt;/code&gt; elements. 
At runtime the remote call fails with &lt;code&gt;PolicyException: None of the policy alternatives can be satisfied.&lt;/code&gt;
Does anybody know how to call such a service?&lt;/p&gt;
&lt;p&gt;&lt;img alt="bpmError" src="https://answers.axonivy.com/upfiles/webserviceExceptionPolicy.png"&gt;
&lt;img alt="policyWsdl" src="https://answers.axonivy.com/upfiles/wsdlWithOptionalPolicies.png"&gt;&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3185/how-to-avoid-policy-error-when-calling-soap-webservices" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 11 Apr 2018 05:46:29 -0400</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/3185/how-to-avoid-policy-error-when-calling-soap-webservices/3186</link><description>&lt;p&gt;&lt;strong&gt;7.1.0 and newer:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You have two possibilities, when using &lt;code&gt;Apache CXF&lt;/code&gt; as your client library:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ignore all policies&lt;/strong&gt;: Many policies are optional and can be completely ignored. You can do this bis adding the feature &lt;code&gt;IgnoreAllPoliciesFeature&lt;/code&gt; to your client web service configuration.
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/ignorePolicyConfig.png"&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ignore some policies&lt;/strong&gt;: By adding the feature &lt;code&gt;IgnorePolicyFeature&lt;/code&gt; you can specify with the property &lt;code&gt;policy.ignore&lt;/code&gt; which policies you want to ignore in your web service client. The property value is a comma-separated list of form &lt;code&gt;namespaceURI:policy&lt;/code&gt;, e.g.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;a href="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:SupportingTokens,http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:RecipientToken"&gt;http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:SupportingTokens,http://schemas.xmlsoap.org/ws/2005/07/securitypolicy:RecipientToken&lt;/a&gt;&lt;/code&gt;
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/IgnorePolicyFeature_pVDNj5g.png"&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;7.0 LTS and older&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Many policies are optional and can be completely ignored. But the integrated &lt;code&gt;Axis 1&lt;/code&gt; and &lt;code&gt;Axis 2&lt;/code&gt; libraries are not able to handle them. The only way out is to patch the WSDL service definition. Remove all &lt;code&gt;Policy&lt;/code&gt; declarations and their references and generate your service again against this modified WSDL.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 11 Apr 2018 05:46:29 -0400</pubDate><guid>https://answers.axonivy.com/questions/3185/how-to-avoid-policy-error-when-calling-soap-webservices/3186</guid></item></channel></rss>