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

Discussion in 'ASP .Net' started by ropo, Oct 14, 2009.

  1. ropo

    ropo Guest

    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>
    ropo, Oct 14, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alan Silver
    Replies:
    1
    Views:
    3,771
    Alan Silver
    Aug 2, 2005
  2. Stanimir Stamenkov
    Replies:
    2
    Views:
    744
    Stanimir Stamenkov
    Oct 25, 2005
  3. Robert Mark Bram
    Replies:
    0
    Views:
    682
    Robert Mark Bram
    Feb 4, 2007
  4. JeffQ888
    Replies:
    0
    Views:
    183
    JeffQ888
    May 23, 2006
  5. gelbeiche
    Replies:
    0
    Views:
    159
    gelbeiche
    Jul 20, 2006
Loading...

Share This Page