Convert PHP Code to C#.NET 2.0




    The incoming parameter for .NET also has to be in object or array form for it to be correctly converted to the XML form that .NET expects The full example (when using WSDL) should be like this:
     $client = new SoapClient("");
     $params->param1 = $value1;
     $params->param2 = $value2;
     $objectresult = $client->MyMethod($params);

    Also note the following.

    When calling over SOAP to a .NET application, you may end up with an object as a result instead of a simple type, even if you're just grabbing a simple type (like a boolean result). Use a property accessor to get the actual result, like this:

     $client = new SoapClient("");
     $params->param1 = $value1;
     $params->param2 = $value2;
     $objectresult = $client->MyMethod($params);


    I am calling this Webservice Using This Method Using Code


    RefLabMaster.ZoasisServicesPortClient zoasisService = new LIS.LISModule.RefLabMaster.ZoasisServicesPortClient();

    RefLabMaster.LabOrder labOrder = new LIS.LISModule.RefLabMaster.LabOrder();

    RefLabMaster.LabOrderItems labOrderItem = new LIS.LISModule.RefLabMaster.LabOrderItems();

    RefLabMaster.LoginObject loginObject = new LIS.LISModule.RefLabMaster.LoginObject();

    loginObject.clinicId = 35285;

    loginObject.corporateId = 0;

    loginObject.userName = "PMStest";

    loginObject.password = "PMStest";

    RefLabMaster.LabResults[] labResults = zoasisService.getAllLabResults(loginObject);

    string ss = labResults[0].labResults;


    I am getting Error


    Error Message : Error is deserilization body of reply message "GetAllLabResults()"

        "There is an Error in XML Documents"


    But when i use PHP Code it is working Fine


    Please give ur suggestion how to migrate above PHP code to


    kinds regards





    Friday, September 21, 2007 5:29 AM


  • I ran into something similar when consuming a third party (non .Net) web service. Everything worked until they sent back error codes in the Xml. Because they didn't properly address the error codes in their schema, .Net would fail with the error you mentioned.

    I had to do a work around that and wrote an article on Code Project entitled, Capturing SOAP messages that serialization cannot handle. If you go that route, read the comments to the post, someone found a quicker way of doing it than I had.

    Friday, September 21, 2007 2:38 PM