svcutil generated code missing parts

872 Views Asked by At

I have this:

"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\bin\svcutil.exe" ^
/noLogo  /t:code  /l:cs /mc /tcv:Version35 /ct:System.Collections.Generic.List`1 /n:*,MYNS ^
/config:MyServiceProxy.config  ^
/out:ServiceProxy.cs  ^
https://remote-service/ServiceA?wsdl 

It generates classes, types and endpoint configurations as I expect. When I add multiple endpoints ex:

"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0A\bin\svcutil.exe" ^
/noLogo  /t:code  /l:cs /mc /tcv:Version35 /ct:System.Collections.Generic.List`1 /n:*,MYNS ^
/config:MyServiceProxy.config  ^
/out:ServiceProxy.cs  ^
https://remote-service/ServiceA?wsdl https://remote-service/ServiceB?wsdl https://remote-service/ServiceC?wsdl 

no endpoints in MyServiceProxy.config, and all the ServiceAWsClient() methods are missing from ServiceProxy.cs.

UPDATE: I removed the /i option, bec it made the classes internal.

UPDATE: I can now generate two .cs files, if I use the /serializer:DataContractSerializer option, I got the ServiceAWsClient() classes and without it I got the shared types. Is there a way to get both the same time?

UPDATE: The file containing the ServiceAWsClient() classes still not good. Methods are missing paramteres. Why? WSDL contains:

<xs:element name="service" type="tns:service"/>
<xs:element name="serviceResponse" type="tns:serviceResponse"/>
<xs:complexType name="service">
    <xs:sequence>
    <xs:element name="context" type="ns1:GenericContext" minOccurs="0"/>
    <xs:element name="userData" type="ns2:UserData" minOccurs="0"/>
</xs:sequence>
</xs:complexType> 
<xs:complexType name="serviceResponse">
    <xs:sequence>
        <xs:element name="resultContext" type="ns1:GenericResponseContext" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

svcutil generates:

public void service()
{
    base.Channel.service();
}

when it should be:

public MYNS.GenericResultContext service(MYNS.GenericContext context, MYNS.ServiceA userData)
{
    MYNS.service inValue = new MYNS.service();
    inValue.context = context;
    inValue.userData = userData;
    MYNS.serviceResponse retVal = ((MYNS.ServiceA)(this)).service(inValue);
    return retVal.resultContext;
}

ty!

1

There are 1 best solutions below

1
On

The generation failed. svcutil does not support multi-targeting.

Infact the ClientBase (the proxy which is generated base class) can only access one endpoint.

You unfortunatly have to generate 3 diffrent proxies. In fact, theses proxies are encapsulating the actual channel (socket) which communicates with the service. So it seems that one proxy can handle only one endpoint