0

I have a library I need to generate client proxy classes for, and the existing code works fine when running this command and the service on my local box

svcutil.exe /config:thn /r:Citi.Rbcs.BusGn.dll /r:Citi.Rbcs.Buscm.dll net.tcp://localhost:8088/RbcThnService/mex

The client proxy is generated fine. RbcThnService uses an interface IRbcThinService. If I then add a new method to that interface as follows

[OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
        [FaultContract(typeof (GenericException))]
        [FaultContract(typeof (CustomException))]
        RbcCustomerStructure GetCustomerStructures(string CustomerId, short QueueId, DateTime dateUpdate, RbcSecurityContext securityContext);

Then rebuild and install the service, and try to regenerate the client proxies, I get

There is an error in the XML document.

The value for the 'type' attribute is invalid - 'q32:ArrayOfstring' is an invalid value for the 'type' attribute.

It sounds like it's not finding a certain type in the declarations, but the odd thing is there is another method in the interface with EXACTLY the same signature in the original library, which allows the client proxy to generate just fine. So I am only creating an identical method to an already existing one, just with a new name.

Does anyone have any suggestions?

UPDATE: Ok the plot thickens, if I comment out even one of the existing methods and retry - it works with the new method. I've tried stripping it down to only a handful of methods plus the new one, it works. I gradually reintroduced the other methods one by one and it kept working, until I added the very final one in, then it errored.

Interestingly I got up to the point of having one original method commented out and it was working, then I created a SECOND dummy NEW method and it errored, same error but instead of ArrayOfstring it had a different type it was failing because of.

So if I'm not barking up the wrong tree it seems to be tied to either the number of methods I have in the interface definition, or the length of the generated XML potentially. Are there any limitations I should be aware of?

NZJames
  • 4,963
  • 15
  • 50
  • 100

1 Answers1

0

For any type of web service, you cannot have overloaded methods. WCF allows this if you specify a different OperationContract Name E.G.

[ServiceContract]
interface IService
{
    [OperationContract(Name="Foo")]
    void Foo();

    [OperationContract(Name="Foobar")]
    void Foo(string bar);

}

But this is basically changing the public signature to the method, even though it is named the same in the interface, so I would generally just not do this, since it can be more confusing when creating your clients.

Check out this post for similar problem. In web services (WCF included) any method that is overloaded (same name) is literally impossible to figure out what you are calling. Change the method name or the Name attribute in the OperationContract to something different and try again.

Community
  • 1
  • 1
iMortalitySX
  • 1,478
  • 1
  • 9
  • 23