Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

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

Reply
 
Old 10-14-2009   #1 (permalink)
ropo


 
 

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

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-
Quote:

>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>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Client Script - File Type VB Script
Call a Contact not working Live Messenger
HTA: type mismatch (runtime) on sub call in OnChange VB Script
WebService and Timeout .NET General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46