SoapException - Fault Element - Compatibility

Discussion in 'ASP .Net Web Services' started by Sambo, Oct 3, 2006.

  1. Sambo

    Sambo Guest

    Hi All

    I'll dot point a few things to try and give some clarity around the
    problem I'm having, and the outcome I need:

    The Web Service construction:

    - My web service is developed in .NET 2.0
    - My web service needs to be constructed/generated from an existing
    WSDL
    - The WSDL was written by a third party (a standards body)
    - The WSDL is also used by other parties that I need to communicate
    with (that do not use .NET and may not be running on a Windopws
    platform)
    - I will be comsuming the third party service and they will be
    consuming mine

    The problem:

    Microsoft.NET "cleverly" handles exceptions as SoapException and maps
    them back to a SOAP fault element. The custom WSDL I need to use to
    generate my web service from contains a clearly defined fault element.
    Unfortunately, WSDL.EXE does not recognise this and will not generate
    an exception class from it for me to raise in code for that web method.

    I need to know whether a client that is NOT written in MS.NET and NOT
    running in a Windows environment will see the required fault element in
    the WSDL produced by my web service after I have used WSDL.EXE to
    generate it from the custom WSDL (that does contain the fault element
    definition).

    I have seen articles on consuming web services and using SOAP
    extensions to read the fault element, likewise to produce a fault
    element at runtime, but I need to be able to ensure the consuming
    application (on a foreign platform) will see my web service's WSDL
    correctly at design time (as defined by the standards body that issued
    it for me to produce my service from).

    Please help. I'm exhausted after reading the entire internet :)

    Thanks in advance,

    Sam
     
    Sambo, Oct 3, 2006
    #1
    1. Advertising

  2. Sambo

    Cookie Guest

    Hi !

    I need some help in invoking a .NET webservice from a Java client.

    I do know how to build the .NET Web service, the issue is what exactly
    do I need to do to invoke from a Java client

    Thanks in advance
     
    Cookie, Oct 3, 2006
    #2
    1. Advertising

  3. Sambo

    Cookie Guest

    Hi !

    I need some help in invoking a .NET webservice from a Java client.

    I do know how to build the .NET Web service, the issue is what exactly
    do I need to do to invoke from a Java client

    Thanks in advance
     
    Cookie, Oct 3, 2006
    #3
  4. "Sambo" <> wrote in message
    news:...
    > Hi All
    >
    > I'll dot point a few things to try and give some clarity around the
    > problem I'm having, and the outcome I need:
    >
    > The Web Service construction:
    >
    > - My web service is developed in .NET 2.0
    > - My web service needs to be constructed/generated from an existing
    > WSDL
    > - The WSDL was written by a third party (a standards body)
    > - The WSDL is also used by other parties that I need to communicate
    > with (that do not use .NET and may not be running on a Windopws
    > platform)
    > - I will be comsuming the third party service and they will be
    > consuming mine
    >
    > The problem:
    >
    > Microsoft.NET "cleverly" handles exceptions as SoapException and maps
    > them back to a SOAP fault element. The custom WSDL I need to use to
    > generate my web service from contains a clearly defined fault element.
    > Unfortunately, WSDL.EXE does not recognise this and will not generate
    > an exception class from it for me to raise in code for that web method.


    You can do this. In order to send a SOAP Fault back to your client, you need
    to explicitly throw a SoapException. Use the constructor overload that
    allows you to set the faultcode and actor elements of the fault.

    You may or may not be able to do this with your WSDL, but since I defined my
    own, here's what I was able to do: I defined all of my faults in a separate
    schema. I ran this schema through xsd.exe to generate the appropriate .NET
    types for the faults. When I want to return a particular SOAP Fault, I
    simply create an instance of one of the fault types and fill in the
    appropriate fields. I then serialize this object to XML, and pass that XML
    as the details parameter of the SoapException constructor.

    I have tested this with a Java client. As you mention in your post, Java
    sensibly translates fault elements into exceptions. My test java client
    correctly caught the faults I returned, and was able to process the contents
    as properties of the Java exception object.

    Good Luck,
    John
     
    John Saunders, Oct 3, 2006
    #4
  5. Sambo

    Sambo Guest

    Love your work John. I'll give it a go.

    Cheers,

    Sam
     
    Sambo, Oct 18, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flare

    Inherit from soapException

    Flare, Oct 23, 2003, in forum: ASP .Net
    Replies:
    9
    Views:
    2,379
    Kevin Spencer
    Oct 24, 2003
  2. Marty McDonald

    SoapException - unusual behavior

    Marty McDonald, May 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    690
    Marty McDonald
    May 19, 2004
  3. HANM
    Replies:
    2
    Views:
    750
    Joseph Kesselman
    Jan 29, 2008
  4. John Saunders
    Replies:
    0
    Views:
    415
    John Saunders
    Aug 23, 2006
  5. Replies:
    0
    Views:
    198
Loading...

Share This Page