- The web service class was generated using svcutil, with the options /useSerializerForFaults; the WSDL defines all operations, and provides links to the types.xsd and the types_fault.xsd files. FYI, the WSD and XSD files are common for many applications
so I cannot modify them (unless of course there some major validation errors)
My issue stands when I send a SOAP Fault to the client : the root tag in the detail of the fault is using a type name, and not a tag name.
Here is the WSDL definition (extracts), to understand the situation better:
So for example, when I send a Response back (no errors occurred), I can use the CreateScheduledWorkResponse element, and fill it correctly; but when a FaultException occurs, I'm only able to send back a CreateScheduledWorkFaultMessage (and not a CreateScheduledWorkFault).
And the client cannot handle this tag...
I suspect that there is something wrong when generating the code from the WSDL and XSD using svcutil, as I am not able to access the desired type in the code.
but when a FaultException occurs, I'm only able to send back a CreateScheduledWorkFaultMessage (and not a CreateScheduledWorkFault). And the client cannot handle this tag...
When you use UseSerializerForFaults, it specifies that the XmlSerializer should be used for reading and writing faults, instead of the default Datacontractserializer, so please make sure you are using XmlSerializer, it uses Datacontractserializer by default.
Best Regards.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
I managed to get the correct type (I modified directly in the generated class; I know it's bad, but there is no other choice in my situation for the moment).
There is an other issue now, as the main tag is not recognized as being a root on the client side.
Here is what I send back (in the <detail> tag of the fault):
borissov
0 Points
4 Posts
SOAP Fault uses Types instead of Tag names
Jan 09, 2013 09:38 AM|LINK
Hello,
First of all, here is my setup:
- .Net 4.0
- WCF service, with basicHttpBinding (soap 1.1)
- The web service class was generated using svcutil, with the options /useSerializerForFaults; the WSDL defines all operations, and provides links to the types.xsd and the types_fault.xsd files. FYI, the WSD and XSD files are common for many applications so I cannot modify them (unless of course there some major validation errors)
My issue stands when I send a SOAP Fault to the client : the root tag in the detail of the fault is using a type name, and not a tag name.
Here is the WSDL definition (extracts), to understand the situation better:
So for example, when I send a Response back (no errors occurred), I can use the CreateScheduledWorkResponse element, and fill it correctly; but when a FaultException occurs, I'm only able to send back a CreateScheduledWorkFaultMessage (and not a CreateScheduledWorkFault). And the client cannot handle this tag...
I suspect that there is something wrong when generating the code from the WSDL and XSD using svcutil, as I am not able to access the desired type in the code.
I use svcutil this way:
svcutil /useSerializerForFaults CSW.wsdl CSW.xsd CSW_Fault.xsd
Thanks for your help, and don't hesitate if you need more details.
Boris
Haixia Xie -...
Contributor
3087 Points
298 Posts
Microsoft
Re: SOAP Fault uses Types instead of Tag names
Jan 10, 2013 08:25 AM|LINK
Hi,
When you use UseSerializerForFaults, it specifies that the XmlSerializer should be used for reading and writing faults, instead of the default Datacontractserializer, so please make sure you are using XmlSerializer, it uses Datacontractserializer by default.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
borissov
0 Points
4 Posts
Re: SOAP Fault uses Types instead of Tag names
Jan 10, 2013 09:10 AM|LINK
Hi,
Thanks for your reply.
Yes, in the interface definition, I specified the use of XmlSerializer :
[ServiceContract(Namespace = "http://www.orange.com/MACHX/Interfaces/ManageScheduledWork/ScheduledWorkManagement/v1")] [XmlSerializerFormat(SupportFaults = true)] public interface IManageScheduledWork { [OperationContract(Action = "http://www.orange.com/MACHX/Interfaces/ManageScheduledWork/ScheduledWorkManagement/v1/CreateScheduledWork")] CreateScheduledWorkResponse CreateScheduledWork(CreateScheduledWorkRequest request); }I also tried to specify the Fault contract :
But then again, I can't use CreateScheduledWorkFault in the type.
Best Regards
borissov
0 Points
4 Posts
Re: SOAP Fault uses Types instead of Tag names
Jan 15, 2013 08:56 AM|LINK
Quick question : is there another way to force the use of the XmlSerializer?
Or is it a WSDL/XSD issue that prevents from generating the correct types?
Thanks for your help.
borissov
0 Points
4 Posts
Re: SOAP Fault uses Types instead of Tag names
Jan 24, 2013 09:30 AM|LINK
Hello,
I managed to get the correct type (I modified directly in the generated class; I know it's bad, but there is no other choice in my situation for the moment).
There is an other issue now, as the main tag is not recognized as being a root on the client side.
Here is what I send back (in the <detail> tag of the fault):
Here is what is expected:
FYI, the system I am communicating with is an EAI middleware (using Java WebMethods I think).
Actually, they receive raw XML like so:
Therefore, I modified the definition in my interface, from :
To:
But when I send the fault to the EAI, the "/root" part is removed, giving:
...does anyone have an idea why this is happening?
FYI, when sending a normal Response (so no faultExceptions have been thrown), they receive the following tag:
Thanks for your help.