Webservice complex type not working when call from C++.NET client app

R

ropo

HOW DOES THE TRUE BECOME FALSE IN THE WEBSERVICE?
WHY DOES IT WORK IN C#?

please read on

I have a webservice implemented using WCF with basicHttpBinding
(config is on the end of this message) The webservice itself is the
hello world example generated by wcf library so has this simple
interface:

[ServiceContract]
public interface IService1 {
[OperationContract]
string GetData(int value);

[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType
composite);
}

// Use a data contract as illustrated in the sample below to
add
composite types to service operations
[DataContract]
public class CompositeType {
bool boolValue = true;
string stringValue = "Hello ";

[DataMember]
public bool BoolValue {
get { return boolValue; }
set { boolValue = value; }
}

[DataMember]
public string StringValue {
get { return stringValue; }
set { stringValue = value; }
}
}

I've setup a virtual directory on IIS and published the service to it.

I have 2 test clients which reference the service and call
GetDataUsingDataContract one is c#.net 2 and the other is C++.net 2

c# test app calls like this
simple.Service1 ser = new
CsharpClient20.simple.Service1();
simple.CompositeType ct = new
CsharpClient20.simple.CompositeType
();
ct.BoolValue = true;
ct.BoolValueSpecified = true;
ct.StringValue = "Boo";
simple.CompositeType result =
ser.GetDataUsingDataContract(ct);

And works as expected

C++ test app calls like this
Service1^ service = gcnew Service1();
simple::CompositeType^ ct = gcnew simple::CompositeType();
ct->BoolValue = true;
ct->BoolValueSpecified = true;
ct->StringValue ="Boo";
simple::CompositeType^ ret = service->GetDataUsingDataContract
(ct);

It calls the function which I can step into but in the webservice ct-
BoolValue == false despite being set to true in the client code

Using the diagnostics tool the last message logged at
'ServiceLevelReceiveRequest' was

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/
2005/05/addressing/none">http://bcs-dev001.blithesystems.local/
simpleTestWCFService/simpleTestWCFService.Service1.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/
2005/05/addressing/none">http://tempuri.org/IService1/
GetDataUsingDataContract</Action>
</s:Header>
<soap:Body>
<GetDataUsingDataContract xmlns="http://tempuri.org/">
<composite>
<StringValue xmlns="http://schemas.datacontract.org/2004/07/
simpleTestWCFService">Boo</StringValue>
<BoolValue xmlns="http://schemas.datacontract.org/2004/07/
simpleTestWCFService">true</BoolValue>
</composite>
</GetDataUsingDataContract>
</soap:Body>
</soap:Envelope>

which shows the value true - So HOW DOES THE TRUE BECOME FALSE IN THE
WEBSERVICE? and WHY DOES IT WORK IN C#? Anyone please this is sending
me crazy

Web service config:

<bindings>
<basicHttpBinding>
<binding name="basicHttpEndpointBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>

<behaviors>
<serviceBehaviors>
<behavior
name="simpleTestWCFService.Service1Behavior">
<serviceCredentials>
<serviceCertificate
findValue="*******"
x509FindType="FindBySubjectName" />
</serviceCredentials>
<dataContractSerializer
maxItemsInObjectGraph="2147483647" />
<serviceMetadata httpGetEnabled="false"
httpsGetEnabled="true" />
<serviceDebug
includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>

<services>
<service name="simpleTestWCFService.Service1"
behaviorConfiguration="simpleTestWCFService.Service1Behavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/
Design_Time_Addresses/simpleTestWCFService/Service1/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding"
contract="simpleTestWCFService.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top