how to handle null values when consume Oracle SOA soap service in c#

82 views Asked by At

I'm trying to consume a soap service which developed by Oracle SOA in c# desktop app. I added service reference to the project and developed the code to use the functions inside soap service like this and every time get exception which explained below please help me to solve this issue:-

CallCenterServiceReference.CallCenterService_pttClient client = new CallCenterServiceReference.CallCenterService_pttClient();
        client.ClientCredentials.UserName.UserName = "";
        client.ClientCredentials.UserName.Password = "";
        CallCenterServiceReference.isPowerCutForNotPay obj = new CallCenterServiceReference.isPowerCutForNotPay();
        CallCenterServiceReference.authStruct auth = new CallCenterServiceReference.authStruct();

        obj.agreeNo = serviceIdTextBox.Text;
        obj.DEVID = null;
        obj.FRF = null;
        auth.systemID = 123;
        auth.authKey = "";
        auth.systemIDSpecified = true;
        obj.auth = auth;

        var response = client.isPowerCutForNotPay(obj).isPowerCutForNotPayResult;
        MessageBox.Show("ResultCode is :-"+response.resultCode);

Exception happen in this line

    var response = client.isPowerCutForNotPay(obj).isPowerCutForNotPayResult;

SOAP Request MSG

<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">
        <isPowerCutForNotPay
            xmlns="http://www.J.com/SampleApplication/CallCenterSystem">
            <agreeNo>3456</agreeNo>
            <DEVID xsi:nil="true"/>
            <FRF xsi:nil="true"/>
            <auth>
                <authKey>1234565</authKey>
                <systemID>2005</systemID>
            </auth>
        </isPowerCutForNotPay>
    </s:Body>
</s:Envelope>

Soap Response MSG

<env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsa="http://www.w3.org/2005/08/addressing">
    <env:Header>
        <wsa:Action>isPowerCutForNotPay</wsa:Action>
        <wsa:MessageID>urn:1d0f3f85-8963-11ee-a4bb-5254003edad5</wsa:MessageID>
        <wsa:ReplyTo>
            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
            <wsa:ReferenceParameters>
                <instra:tracking.ecid
                    xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">f99958a9-fe21-4f48-871e-eef4aadfc448-007192ac
                </instra:tracking.ecid>
                <instra:tracking.FlowEventId
                    xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">70056562
                </instra:tracking.FlowEventId>
                <instra:tracking.FlowId
                    xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">122084
                </instra:tracking.FlowId>
                <instra:tracking.CorrelationFlowId
                    xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">0000OjsFbzE6iKG6yzvX6G1_8zCF0000ax
                </instra:tracking.CorrelationFlowId>
                <instra:tracking.quiescing.SCAEntityId
                    xmlns:instra="http://xmlns.oracle.com/sca/tracking/1.0">70096
                </instra:tracking.quiescing.SCAEntityId>
            </wsa:ReferenceParameters>
        </wsa:ReplyTo>
        <wsa:FaultTo>
            <wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>
        </wsa:FaultTo>
    </env:Header>
    <env:Body>
        <isPowerCutForNotPayResponse
            xmlns:ns1="http://xmlns.oracle.com/CallCenter/JDECOCallCenter/JDECOCallCenterService"
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
            xmlns:wsp="http://www.w3.org/ns/ws-policy"
            xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
            xmlns:ouaf="http://ouaf.oracle.com/"
            xmlns:tns="http://www.J.com/SampleApplication/CallCenterSystem"
            xmlns="http://www.J.com/SampleApplication/CallCenterSystem">
            <tns:isPowerCutForNotPayResult>
                <tns:resultCode>-1</tns:resultCode>
                <tns:resultStringA/>
                <tns:resultStringE>Invalid Account ID</tns:resultStringE>
                <tns:resultStringH/>
                <tns:customMessageA/>
                <tns:customMessageE/>
                <tns:customMessageH/>
                <tns:trans>
                    <tns:DEVID/>
                    <tns:FRF/>
                    <tns:JRF>1373</tns:JRF>
                    <tns:systemID>2005</tns:systemID>
                </tns:trans>
                <tns:value/>
            </tns:isPowerCutForNotPayResult>
        </isPowerCutForNotPayResponse>
    </env:Body>
</env:Envelope>

But when I run the application I got this error any one can help me to solve this problem??

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text ************** System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'isPowerCutForNotPay'. ---> System.InvalidOperationException: There is an error in XML document (1, 2104). ---> System.FormatException: The string '' is not a valid Boolean value. at System.Xml.XmlConvert.ToBoolean(String s) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderJDECOCallCenterService_ptt.Read5_Utils_ResultClassOfboolean(Boolean isNullable, Boolean checkType) at

0

There are 0 answers