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);
}
Ondrej Svejdar
  • 21,349
  • 5
  • 54
  • 89
NickD
  • 2,672
  • 7
  • 37
  • 58
  • Question: Why does WCF client not able to use Efficient – DataContractSerializer? Answer: https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/data-contract-schema-reference 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. – NickD Jun 23 '17 at 11:39
  • This was new feedback from today of the MS support team – NickD Jun 23 '17 at 11:39
  • 1
    I found this https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/using-the-xmlserializer-class 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" – Ernesto Jun 29 '17 at 15:20
  • Ernesto: That is right. Microsoft Support tries to fix the WSDL for me, but this seems to be difficult. – NickD Jul 01 '17 at 10:11
  • http://webservices20.blogspot.de/2008/10/interoperability-gotcha-doclitwrapped.html – NickD Jul 01 '17 at 10:11
  • 1
    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 ? – NickD Jul 01 '17 at 10:15
  • Maybe you should change the question with the specific third party name in case someone has gone through the same. – Ernesto Jul 03 '17 at 14:57

2 Answers2

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.

Piotr
  • 1,155
  • 12
  • 29
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.

Dave
  • 135
  • 7