Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dears I am accessing and work serice using SoapUi tool successful but when call web service using .net client i got following error "Element ClaimDetails from namespace cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML". My Web Method defination like this
VB
Public Function getResults(ByVal UserName As String, ByVal Password As String, ByRef RegNo As String, ByRef ChassisNo As String, ByRef EngineNo As String, ByVal policyNo As String, ByVal insurerName As String, <system.runtime.interopservices.outattribute()> ByRef ClaimDetails As Object) As String

My Code:
C#
protected void BTN_Go_Click(object sender, EventArgs e)
    {
        try
        {
           
            String[] objClaimDtl = { };
           
            IIBClaint.IBWebServiceClient objClient = new IIBClaint.IBWebServiceClient();
            IIBClaint.getResultsRequest objResultrequest = new IIBClaint.getResultsRequest(new IIBClaint.getResultsRequestBody(TXT_UserName.Text, TXT_Password.Text, TXT_RegisterNo.Text, TXT_ChassisNo.Text, TXT_EnginNo.Text, TXT_PolicyNo.Text, TXT_InsurerName.Text));
            IIBClaint.getResultsResponse objresponce = new IIBClaint.getResultsResponse(new IIBClaint.getResultsResponseBody("RJ146218", "", "", "", objClaimDtl));
           
            HttpWebRequest webRequest = (HttpWebRequest)System.Net.WebRequest.Create(ConfigurationManager.AppSettings["ServiceURL"]);
            webRequest.Proxy = System.Net.WebRequest.DefaultWebProxy;
          
            string localProxyUserName = ConfigurationManager.AppSettings["ProxyUserName"];
            string localProxyPassword = ConfigurationManager.AppSettings["ProxyUserPassword"];
            string localProxyDomainName = ConfigurationManager.AppSettings["ProxyDomainName"];
         
            webRequest.Proxy.Credentials = new NetworkCredential(localProxyUserName, localProxyPassword, localProxyDomainName);

            // var strResult = objClient.getResults(TXT_UserName.Text, TXT_Password.Text,ref strRegNo,ref strChassisno,ref strEnginNo,TXT_PolicyNo.Text, TXT_InsurerName.Text,out objClaimDtl);
            objresponce = objClient.getResults(objResultrequest);
          
        }
        catch (Exception ex)
        {
            TXT_Responce.Text = ex.InnerException.Message;
        }
    }



b>Service WSDL :b>
XML
"<wsdl:definitions name="IIBWebService" targetnamespace="http://localhost:9096/IIBWebService/" xmlns:wsdl="#unknown"><wsdl:types><xsd:schema targetnamespace="http://localhost:9096/IIBWebService/" xmlns:xsd="#unknown"><xsd:element name="getResults"><xsd:complextype><xsd:sequence><xsd:element name="UserName" type="xsd:string" /><xsd:element name="Password" type="xsd:string" /><xsd:element name="RegNo" type="xsd:string" /><xsd:element name="ChassisNo" type="xsd:string" /><xsd:element name="EngineNo" type="xsd:string" /><xsd:element name="policyNo" type="xsd:string" /><xsd:element name="insurerName" type="xsd:string" /></xsd:sequence></xsd:complextype></xsd:element><xsd:element name="getResultsResponse"><xsd:complextype><xsd:sequence><xsd:element name="Authentication" type="xsd:string" /><xsd:element name="RegNo" type="xsd:string" /><xsd:element name="ChassisNo" type="xsd:string" /><xsd:element name="EngineNo" type="xsd:string" /><xsd:element name="ClaimDetails" nillable="true" soapenc:arraytype="xsd:string[]" xmlns:soapenc="#unknown" /></xsd:sequence></xsd:complextype></xsd:element></xsd:schema></wsdl:types><wsdl:message name="getResultsRequest"><wsdl:part name="parameters" element="tns:getResults">
    </wsdl:part></wsdl:message><wsdl:message name="getResultsResponse"><wsdl:part name="parameters" element="tns:getResultsResponse">
    </wsdl:part></wsdl:message><wsdl:porttype name="IIBWebService"><wsdl:operation name="getResults"><wsdl:input message="tns:getResultsRequest">
    </wsdl:input><wsdl:output message="tns:getResultsResponse">
    </wsdl:output></wsdl:operation></wsdl:porttype><wsdl:binding name="IIBWebServiceSOAP" type="tns:IIBWebService"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="#unknown" /><wsdl:operation name="getResults"><soap:operation soapaction="http://localhost:9096/IIBWebService/getResults" xmlns:soap="#unknown" /><wsdl:input><soap:body use="literal" xmlns:soap="#unknown" /></wsdl:input><wsdl:output><soap:body use="literal" xmlns:soap="#unknown" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="IIBWebService"><wsdl:port name="IIBWebServiceSOAP" binding="tns:IIBWebServiceSOAP"><soap:address location="http://iib.gov.in/IIBWebServicesV3.0/services/IIBWebService/" xmlns:soap="#unknown" /></wsdl:port></wsdl:service></wsdl:definitions>"
Posted
Updated 21-Mar-18 12:24pm
v13
Comments
ashok rathod 19-Jun-14 2:34am    
Please paste your code in proper format and would also like to see your code and your configuration file as well. Otherwise it is not easy to identify the issue.

1 solution

After add web reference deserialization problem solved,
deserialization problem reason -- I had added Service reference .
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900