Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: SoapFault

  1. #11
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    Hi Arjen,

    i just try to understand the new soap api.
    In M1, i was able to write
    Code:
    SoapBody body = response.getSoapBody();
    body.addFault( [....] );
    In the new SOAP API of M2, there are 4 methods:
    Code:
    body.addMustUnderstandFault()
    body.addVersionMismatchFault()
    body.addClientOrSenderFault()
    body.addServerOrReceiverFault()
    But how can i add a custom fault code?

    I just saw in subversion your comment: "custom code, only supported for SOAP 1.1".
    Does my application needs to use SOAP 1.1 if i want to use custom fault codes?
    What are the consequences?
    What are the disadvantages/drawbacks?

    Cheers,

    Ingo

  2. #12
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Yeah, the API has changed so that it reflects the common denominator between SOAP 1.1 and SOAP 1.2. SOAP 1.1 supports custom faults codes, which SOAP 1.2 does not. In SOAP 1.2, you can only add you custom fault subcode to one of the standard error codes (MustUnderstand, VersionMismatch, Sender, or Receiver, see addSubcode in Soap12Fault). So you have to cast the SoapBody to Soap11Body, and then you can add your fault.

    Basically, you probably want to use SOAP 1.1 anyway. SOAP 1.2 is not supported by many clients yet. Unless you know you really need it, it's best to use SOAP 1.1.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #13
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    Basically, you probably want to use SOAP 1.1 anyway. SOAP 1.2 is not supported by many clients yet. Unless you know you really need it, it's best to use SOAP 1.1.
    Ok, but i can switch to SOAP 1.2 if i really need that in a year?


    Is it possible to switch my SWS-application to SOAP1.2?
    I see your type cast, but where is it defined that SWS uses SOAP 1.1?
    Code:
     if (soapBody instanceof Soap11Body) {
                    Soap11Body soap11Body = (Soap11Body) soapBody;
    I don't need it, but i need to satisfy my curiosity.

    Ingo

  4. #14
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    The MessageContextFactories basically detect what the version of the incoming message is, and uses that also for the request message, so it does it dynamically.

    Note that you will need SAAJ 1.3 (saaj.dev.java.net) to support SOAP 1.2. Then, you can set a property on the SaajSoapMessageContextFactory (soapProtocol) to set the version statically.

    Which reminds me, I should add a similar property to Axiom.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •