That's what I did. I never found another solution for this, so if you have something better, by all means, make a contribution.
First, the definition of a long array in the wsdl: types scope:
<xsd:complexType name="ArrayOf_xsd_long"> <xsd:complexContent mixed="false"> <xsd:restriction base="soapenc:Array"> <xsd:attribute wsdl:arrayType="soapenc:long[]" ref="soapenc:arrayType" /> </xsd:restriction> </xsd:complexContent> </xsd:complexType>
Then we create the SoapExtensionAttribute attribute that will perform the correction. It seems that the problem was that .NET did not execute the multiref identifier for the element containing the double value. So, we process the element of the array, find the value, and then insert it into the element:
[AttributeUsage(AttributeTargets.Method)] public class LongArrayHelperAttribute : SoapExtensionAttribute { private int priority = 0; public override Type ExtensionType { get { return typeof (LongArrayHelper); } } public override int Priority { get { return priority; } set { priority = value; } } } public class LongArrayHelper : SoapExtension { private static ILog log = LogManager.GetLogger(typeof (LongArrayHelper)); public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute) { return null; } public override object GetInitializer(Type serviceType) { return null; } public override void Initialize(object initializer) { } private Stream originalStream; private Stream newStream; public override void ProcessMessage(SoapMessage m) { switch (m.Stage) { case SoapMessageStage.AfterSerialize: newStream.Position = 0;
Finally, we mark all the methods in the Reference.cs file that will deserialize the long array with our attribute:
[SoapRpcMethod("", RequestNamespace="http://some.service.provider", ResponseNamespace="http://some.service.provider")] [return : SoapElement("getFooReturn")] [LongArrayHelper] public Foo getFoo() { object[] results = Invoke("getFoo", new object[0]); return ((Foo) (results[0])); }
This fix is ββlong-specific, but it can probably be generalized to handle any primitive type that has this problem.
source share