<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SOAP webservice: changing status code? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488191#M4679155</link>
    <description>&lt;P&gt;I created a Web service provider via a dummy WSDL with just one fault. When activating it, it creates an exception class &amp;lt;prefix&amp;gt;cx_&amp;lt;fault&amp;gt; for the defined fault &amp;lt;fault&amp;gt;, which inherits from CX_AI_APPLICATION_FAULT. When implementing the Web service, you raise the fault using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RAISE EXCEPTION NEW &amp;lt;prefix&amp;gt;cx_&amp;lt;fault&amp;gt;( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I feel that it should raise a soap-env:fault with all elements from this exception class + http 500. Now I didn't finish the verification.&lt;/P&gt;</description>
    <pubDate>Fri, 31 Dec 2021 17:27:43 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2021-12-31T17:27:43Z</dc:date>
    <item>
      <title>SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaq-p/12488184</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
  &lt;P&gt;We're developing a SOAP(ish) webservice in which the other party is asking that we modify the HTTP status code depending on the result of the operation, for example:&lt;/P&gt;
  &lt;UL&gt; 
   &lt;LI&gt;200: the operation was carried out successfully&lt;/LI&gt; 
   &lt;LI&gt;500: the operation failed, for a number of reasons&lt;/LI&gt; 
  &lt;/UL&gt;
  &lt;P&gt;As far as my understanding goes, this does not really make sense in the context of SOAP: the conversation happens via XML files and whatever message we have should be sent as a node within that file! In all cases, when the XML text is sent back correctly, the status code will always be 200, regardless of the underlying operation.&lt;/P&gt;
  &lt;P&gt;However, we managed to force the status code in a &lt;A href="https://answers.sap.com/answers/2427840/view.html" target="_blank"&gt;rather brutal way&lt;/A&gt;: MESSAGE 'some explanation' TYPE 'E' RAISING ZEXCEPTION. Actually, the key step is type E, the exception is ignored.&lt;/P&gt;
  &lt;P&gt;The outcome, as seen from SoapUI, is the following:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2006867-immagine-2021-12-31-125955.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Good: 500 can be set&lt;/P&gt;
  &lt;P&gt;Bad: "some explanation" is not visible to the caller (perhaps in the SOAMANAGER logs but that's not enough).&lt;/P&gt;
  &lt;P&gt;I'm afraid I know the answer but.... trying anyway: is it at all possible, within the custom code which carries out the operation, to have an exception or error message of some sort which is then escalated through ICF in a way that is visible to the caller?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 17:19:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaq-p/12488184</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-12-28T17:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488185#M4679149</link>
      <description>&lt;P&gt;Thanks, Robert.&lt;/P&gt;&lt;P&gt;In A4H, SRT_UTIL has nothing at all in it, but I use it so rarely that I'm probably using it wrong. Anyway, with RZ10 I set the flag to TRUE in the DEFAULT profile / ext.maint., then saved (got a new version), activated and restarted the container. After checking that it is correctly set, I have tried the SOAP call again but I still only get the 500 status code when I enable the following line in &lt;A href="https://github.com/AndreaBorgia-Abo/ABAP-Examples/commit/152edfe8d1b9f3c7a6a2f29f536fc4193e9ca08a" target="_blank"&gt;my sample code&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;MESSAGE e001(zabo) RAISING zexception.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 11:58:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488185#M4679149</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-12-31T11:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488186#M4679150</link>
      <description>&lt;P&gt;No idea what SOAP says about functional errors and 500.&lt;/P&gt;&lt;P&gt;What happens if you do this? (and any parameter you want)&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RAISE EXCEPTION NEW cx_soap_application( ).&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 13:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488186#M4679150</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-12-31T13:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488187#M4679151</link>
      <description>&lt;P&gt;No changes, I still get the 500 status with the generic message:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2006868-immagine.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 13:24:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488187#M4679151</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-12-31T13:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488188#M4679152</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;c5e08e0478aa4727abc4482f5be390b2&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;the parameter is dynamic. You can change it in RZ11, no restart is needed.&lt;/P&gt;&lt;P&gt;In SRT_UTIL there is an Error Log button.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2005906-srt-util-error-log-btn.png" /&gt;&lt;/P&gt;&lt;P&gt;goes to&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2005907-srt-util-error-log.png" /&gt;&lt;/P&gt;&lt;P&gt;I tested it on S/4HANA FOUNDATION 2021, but there should be no difference.&lt;/P&gt;&lt;P&gt;My test function has just &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;MESSAGE 'some explanation' TYPE 'E'.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Happy New Year!&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 14:14:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488188#M4679152</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2021-12-31T14:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488189#M4679153</link>
      <description>&lt;P&gt;You rock, Robert! RZ11 for the win!&lt;/P&gt;&lt;P&gt; And thanks for the SRT_UTIL tip, I found evidence of all the attempts.&lt;/P&gt;&lt;P&gt;Happy New Year to you as well! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 15:35:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488189#M4679153</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-12-31T15:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488190#M4679154</link>
      <description>&lt;P&gt;Update: after the RZ11 tip below, I am able to see the errors in the logs but the unhandled exception prevents any kind of reply from being sent back by the server. I will have to re-check the usage of exceptions, definitely! &lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 15:40:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488190#M4679154</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2021-12-31T15:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488191#M4679155</link>
      <description>&lt;P&gt;I created a Web service provider via a dummy WSDL with just one fault. When activating it, it creates an exception class &amp;lt;prefix&amp;gt;cx_&amp;lt;fault&amp;gt; for the defined fault &amp;lt;fault&amp;gt;, which inherits from CX_AI_APPLICATION_FAULT. When implementing the Web service, you raise the fault using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RAISE EXCEPTION NEW &amp;lt;prefix&amp;gt;cx_&amp;lt;fault&amp;gt;( ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I feel that it should raise a soap-env:fault with all elements from this exception class + http 500. Now I didn't finish the verification.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 17:27:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488191#M4679155</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2021-12-31T17:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488192#M4679156</link>
      <description>&lt;P&gt;Enterprise services, create, external wsdl/schema: is that right?&lt;/P&gt;&lt;P&gt;In my case, I went for "existing abap object": my colleague had already created the function module and I wanted to test the same scenario.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 17:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488192#M4679156</guid>
      <dc:creator>abo</dc:creator>
      <dc:date>2022-01-01T17:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: SOAP webservice: changing status code?</title>
      <link>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488193#M4679157</link>
      <description>&lt;P&gt;Yes, it's what I did (SE80 &amp;gt; enterprise services &amp;gt; proxy object &amp;gt; use external key &amp;gt; external WSDL &amp;gt; service provider &amp;gt; ...)&lt;/P&gt;&lt;P&gt;If people don't want to activate the profile parameter &lt;STRONG&gt;is/HTTP/show_detailed_errors = TRUE &lt;/STRONG&gt; for some security considerations, instead of using the Web service generated for the RFC-enabled function module, you may reuse the WSDL proposed for this function module (which proposes one generic fault for all exceptions), enrich the WSDL with all the faults you wish, create a Web service from scratch, it will create one exception class per fault, implement the ABAP class, call the function module and raise the faults when desired.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 20:29:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/soap-webservice-changing-status-code/qaa-p/12488193#M4679157</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-01-01T20:29:55Z</dc:date>
    </item>
  </channel>
</rss>

