Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] die with fault, how to handle more details

Expand Messages
  • Paul Kulchenko
    Hi, Weidong! ... That s right but that s not all requirements. Immediate child of detail element should be namespace qualified, so it incorrect. ... should be
    Message 1 of 2 , Jul 10, 2001
    • 0 Attachment
      Hi, Weidong!

      > Accoridng to SOAP spec, application specific error code and
      > information
      > should be carried in the "detail" part of the fault, so I am
      > defining the soap fault as:
      That's right but that's not all requirements. Immediate child of
      detail element should be namespace qualified, so it incorrect.

      > <detail>
      > <appFaultCode/>
      > <appFaultAction/>
      > </detail>
      should be

      <detail>
      <a:appFaultCode xmlns:a="MyNamespace"/>
      <a:appFaultAction xmlns:a="MyNamespace"/>
      </detail>

      or better

      <detail>
      <a:myerror xmlns:a="MyNamespace">
      <appFaultCode/>
      <appFaultAction/>
      </a:myerror>
      </detail>

      It's possible to generate both from SOAP::Lite.

      -> faultdetail(
      SOAP::Data->value(bless {appFaultAction => 'correct',
      appFaultCode => $code} => 'ORDetail')
      ->uri("MyNamespace")
      )

      gives you the later and

      -> faultdetail(
      SOAP::Data->value(
      SOAP::Data->name(appFaultAction => 'correct')
      ->uri("MyNamespace"),
      SOAP::Data->name(appFaultCode => 123)
      ->uri("MyNamespace"),
      )
      )

      should give you the former. I recommend you the later.

      Best wishes, Paul.

      --- Weidong Wang <wwang@...> wrote:
      > Accoridng to SOAP spec, application specific error code and
      > information
      > should be carried in the "detail" part of the fault, so I am
      > defining the
      > soap fault as:
      >
      > <Fault>
      > <faultcode/>
      > <faultstring/>
      > <detail>
      > <appFaultCode/>
      > <appFaultAction/>
      > </detail>
      > </Fault>
      >
      > I do the die_with_fault as follows:
      >
      > sub die_with_fault # (code, string)
      > {
      > local ($code, $string) = @_;
      >
      > die SOAP::Fault
      > -> faultcode('Client')
      > -> faultstring($string)
      > -> faultdetail(bless {appFaultAction => 'correct',
      > appFaultCode =>
      > $code} => 'ORDetail');
      > }
      >
      > which produces the followign XML data (just the part for the
      > fault):
      >
      > <SOAP-ENV:Fault>
      > <faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
      > <faultstring xsi:type="xsd:string">Named queue already
      > exists</faultstring>
      > <detail>
      > <ORDetail xsi:type="SOAP-ENC:ORDetail">
      > <appFaultAction
      > xsi:type="xsd:string">correct</appFaultAction>
      > <appFaultCode
      >
      xsi:type="xsd:string">Server.QueueingService.QueueExist</appFaultCode>
      > </ORDetail>
      > </detail>
      >
      >
      <faultactorxsi:type="xsd:string">http://wang2.internalgroove.net:88/</faulta
      > ctor>
      > </SOAP-ENV:Fault>
      >
      > Notice there is an extra layer between <detail> and <appFaultCode>.
      >
      > Is there a way to trim that extra layer? Thanks.
      >
      > Weidong
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Get personalized email addresses from Yahoo! Mail
      http://personal.mail.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.