Can the data contract serializer used for any third party webservice
Asked Answered
W

2

11

I have a large third party webservice; the reference.cs is 33 Mbyte. Using Visual Studio 2017, the proxy uses the XML Serializer, which causes a 5 second delay when creating the channel. I opened a case at Microsoft, and they showed me partially how to modify the reference.cs to use the Datacontract serializer. On the same machine the channel is created in 20 mseconds, which would perfect match my needs.

Unfortunatly the messages fail with small differences, and Microsoft support cannot help.

Are there known restrictions? Any patterns I should look for which makes it for sure it will not work at all and I should start rewriting everything using HTTP Requests?

Actual method which results in overall delay:

public XmlMembersMapping ImportMembersMapping(string elementName, string ns,
  XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors,
  bool validate, XmlMappingAccess access) {
  ElementAccessor element = new ElementAccessor();
  element.IsSoap = true;
  element.Name = elementName == null || elementName.Length == 0 ? elementName : 
    XmlConvert.EncodeLocalName(elementName);
}
Weave answered 19/6, 2017 at 18:11 Comment(7)
Question: Why does WCF client not able to use Efficient – DataContractSerializer? Answer: learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/… In short, some of the mappings are not correct between WSDL and XSD and svcutil.exe will eventually reject and fallback to XML Serilizer by default. This should be reviewed and fixed from partner team who provided these files.Weave
This was new feedback from today of the MS support teamWeave
I found this docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/… which could explain why the XMLSerializer was selected when creating the proxy instead of default datacontract serializer. Problem might be on the third party side. "When using Svcutil.exe or the Add Service Reference feature in Visual Studio to generate client code for a third-party service, or to access a third-party schema, an appropriate serializer is automatically selected for you. If the schema is not compatible with the DataContractSerializer, the XmlSerializer is selected"Mc
Ernesto: That is right. Microsoft Support tries to fix the WSDL for me, but this seems to be difficult.Weave
webservices20.blogspot.de/2008/10/…Weave
What I learnt so far, WCF should be 100% WS-* compatible. Maybe there is a ws* lint tool which is not from Microsoft which could be used to proof to the provider of my webservice (btw. Amadeus.com it is). Most likely from the W3C ?Weave
Maybe you should change the question with the specific third party name in case someone has gone through the same.Mc
M
1

Any patterns I should look for which makes it for sure it will not work at all and I should start rewriting everything using HTTP Requests?

I've made Amadeus integration. Unfortunately, sending HTTP requests was the only solution for me as well. I'm composing Envelopes and "inject" data and send such to webservice and then filling responses by XDocument.

Mild answered 2/8, 2017 at 10:29 Comment(0)
G
1

I've had this problem numerous times. The problem is due to the size of the WSDL that you have from Amadeus. The larger the number of services, the slower it performs. If you create software for air, hotel and car products you end up with a large number of services.

You have two options in this respect;

  1. Ask Amadeus to reduce the size of the WSDL for the services that you need for specific projects. A bit painful.
  2. Edit the WSDL yourself into a smaller size based on your requirements. For example to do hotel search, just create a WSDL package yourself for those few services and then create another WSDL package yourself for the hotel booking part. Performance gain is substantial.

I go with option 2 as getting Amadeus to implement option 1 is painful and not worth the hassle.

Georg answered 24/8, 2017 at 16:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.