This discussion is archived
3 Replies Latest reply: Sep 10, 2013 6:29 AM by phillips_chris RSS

apex_web_service.make_request throws ORA-29273: HTTP request failed. How to get the soap fault XML?

1008638 Newbie
Currently Being Moderated

I am trying to call a web service using apex_web_service.make_request function.

It works fine when all the parameters are correct. However, when something is wrong in the request XML, it throws an exception instead of returning the soap:fault message:

 

ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1369
ORA-29269: HTTP server error 500 - Internal Server Error
ORA-06512: at "APEX_040200.WWV_FLOW_WEBSERVICES_API", line 130
ORA-06512: at line 37

 

I need to get back the soap:fault and parse it to display a proper error message to the users (e.g. what was wrong with the input), yet the call throws an exception instead of returning it.

I am trying the exact same request from soapUI and it returns me the soap:fault below:

 

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

   <soap:Body>

      <soap:Fault>

         <soap:Code>

            <soap:Value>soap:Receiver</soap:Value>

         </soap:Code>

         <soap:Reason>

            <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>

         </soap:Reason>

         <soap:Detail>

            <ns1:RegisterFault xmlns:ns1="http://www.exchangenetwork.net/wsdl/register/1">

               <description xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1">The security token has expired.</description>

               <errorCode xsi:type="ns2:RegisterErrorCode" xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">E_TokenExpired</errorCode>

            </ns1:RegisterFault>

         </soap:Detail>

      </soap:Fault>

   </soap:Body>

</soap:Envelope>

 

How do I get this back from APEX?

 

Thanks!

  • 1. Re: apex_web_service.make_request throws ORA-29273: HTTP request failed. How to get the soap fault XML?
    Mike Kutz Expert
    Currently Being Moderated

    oracle has XML data parsing built into SQL.

    use XMLTable() : http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions253.htm#CIHGGHFB

     

    example code:

    select *
    from XMLTable( xmlnamespaces(
                   'http://www.w3.org/2003/05/soap-envelope' as "soap"
                  ,'http://www.exchangenetwork.net/wsdl/register/1' as "ns1"
                  ,'http://www.exchangenetwork.net/wsdl/register/1' as "ns2"
                  ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi"
                  ),
      '/'
      passing XMLType('<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
       <soap:Body>
          <soap:Fault>
             <soap:Code>
                <soap:Value>soap:Receiver</soap:Value>
             </soap:Code>
             <soap:Reason>
                <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text>
             </soap:Reason>
             <soap:Detail>
                <ns1:RegisterFault xmlns:ns1="http://www.exchangenetwork.net/wsdl/register/1">
                   <description xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1">The security token has expired.</description>
                   <errorCode xsi:type="ns2:RegisterErrorCode" xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">E_TokenExpired</errorCode>
                </ns1:RegisterFault>
             </soap:Detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>')
    COLUMNS
       code varchar2(100) PATH '/soap:Envelope/soap:Body/soap:Fault/soap:Code/soap:Value'
      ,error_desc varchar2(1000) PATH '/soap:Envelope/soap:Body/soap:Fault/soap:Detail/ns1:RegisterFault/description'
      ,errorCode  varchar2(200) PATH  '/soap:Envelope/soap:Body/soap:Fault/soap:Detail/ns1:RegisterFault/errorCode'
    );
  • 2. Re: apex_web_service.make_request throws ORA-29273: HTTP request failed. How to get the soap fault XML?
    1008638 Newbie
    Currently Being Moderated

    Thanks Mike. Yes, I know how to parse the soap fault, the problem is that I don't get it returned by the apex_web_service.make_request functions, as it throws the exception instead of returning me back the soap fault as XMLTYPE.

  • 3. Re: apex_web_service.make_request throws ORA-29273: HTTP request failed. How to get the soap fault XML?
    phillips_chris Newbie
    Currently Being Moderated

    Hi,

     

       I've just run into this.

       If the webservice returns a fault, such as:

     

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>INVALID_REQUESTER_INFO</faultstring></soap:Fault></soap:Body></soap:Envelope>

     

       then the user gets presented with an unfriendly error message and there's no chance to output a more friendly one.

       The response above is seen when testing the webservice, when run from the Form/Report page, we get something like:

     

    soap:ServerINVALID_REQUESTER_INFO

    Contact your application administrator.

    OK

     

       When OK button is clicked everything is rolled back and we don't even get the fault XML.

       It would be good if Apex could be optionally set to not give the unfriendly messages, so that we could code such a message ourselves.

       Unless anybody has a workaround for this, I guess that I'll have to see if I can code this in PLSQL.

    Regards,

    Chris

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points