Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Webservice complex type not working when call from C++.NET client app

Reply
Thread Tools

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

 
 
ropo
Guest
Posts: n/a
 
      10-14-2009
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/"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xmlnssd="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.Servic e1Behavior">
<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>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous Call of WebService method within a WebService RenÚ Preu▀ler ASP .Net Web Services 0 10-29-2008 11:55 AM
wsdl2java: method parameter a complex type that extends another complex type Robert Mark Bram Java 0 02-04-2007 10:06 AM
Problem to call a WEBSERVICE in another WEBSERVICE (AXIS/ TOMCAT) Cyril Java 2 06-01-2006 06:07 PM
Need help for COM working from .NET Web app, but not working from .NET EXE app JeffQ888 ASP .Net Web Controls 0 05-23-2006 03:38 PM
[XML Schema] Content type of complex type definition with complex content Stanimir Stamenkov XML 2 10-25-2005 10:16 AM



Advertisments