[ad_1]
I have the following service interface that I have imported using the Visual Studio tool (it is a WCF Web Service).
But when I try to consume the service AuthenticateJAAS (execute the web service), I get the following error:
InvalidOperationException: The top XML element ‘parameters’ from namespace ” references distinct types XAFProject.Module.WS.MCWFUsers.mcwfUsersGetUserGroupsIn and XAFProject.Module.WS.MCWFUsers.mcwfUsersAuthenticateJAASIn. Use XML attributes to specify another XML name or namespace for the element or types.
I cannot change the namespace or the element name ‘parameters’, as it is from a WSDL that cannot be changed (third party). When I remove the class GetUserGroupsRequest and related content from the Reference.cs, I can consume the web service AuthenticateJAAS without problems. The generated XML is:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AuthenticateJAAS xmlns="http://services.senior.com.br">
<user xmlns=""/>
<password xmlns=""/>
<encryption xmlns="">0</encryption>
<parameters xmlns="">
<flowInstanceID xsi:nil="true"/>
<flowName xsi:nil="true"/>
<pmUserName>******</pmUserName>
<pmUserPassword>******</pmUserPassword>
</parameters>
</AuthenticateJAAS>
</s:Body>
</s:Envelope>
Is there a way to use both methods/services (AuthenticateJAAS + GetUserGroupsRequest) without any error? I was thinking that maybe, if I use namespace prefixes, I could manage to use both services, I think.
Here is the part of the code that I initialize the client and execute the service:
sapiens_SyncMCWFUsersClient mCWFUsersClient = new sapiens_SyncMCWFUsersClient();
mcwfUsersAuthenticateJAASIn parameters = new mcwfUsersAuthenticateJAASIn();
parametrosEntrada.pmUserName = "******";
parametrosEntrada.pmUserPassword = "******";
parametrosEntrada.pmEncrypted = 0;
AuthenticateJAASRequest request = new AuthenticateJAASRequest("", "", 0, parameters);
AuthenticateJAASResponse response = mCWFUsersClient.AuthenticateJAAS(request);
[ad_2]