title: Passing PHP parameter to WCF - loosing string values - loosing all values
body: <p>I am having trouble getting my PHP application to correctly pass parameters to my .NET 4.0 WCF Service.
  Here is the service code:</p>
  
  <pre><code>[OperationBehavior(ReleaseInstanceMode = ReleaseInstanceMode.AfterCall)]
  int ICatalogService.CalculatePercentComplete(CoursePercentParam cpp)
  {
       string courseID = cpp.Course;
       int mediaIndex = cpp.MediaIndex;
       double position = cpp.Position;
  
       return ((ICatalogService)this).CalculateCoursePercentComplete(courseID, mediaIndex, position);
  }
  </code></pre>
  
  <p>and the CoursePercentParam class:</p>
  
  <pre><code>[DataContract(Namespace = "Somenamespace.Core.1.0")]
  public class CoursePercentParam
  {
      string course;
      int mediaindex;
      double position;
      public CoursePercentParam()
      {
      }
      public CoursePercentParam(CoursePercentParam cpp)
          : this()
      {
          this.Course = cpp.Course;
          this.MediaIndex = cpp.MediaIndex;
          this.Position = cpp.Position;
      }
  
      public string Course { get { return this.course; } set { this.course = value; } }
      public int MediaIndex { get { return this.mediaindex; } set { this.mediaindex = value; } }
      public double Position { get { return this.position; } set { this.position = value; } }
  }
  </code></pre>
  
  <p>Note that there are several other places in the code where I can call to this service without trouble.  - works as expected.  The communications between the web application and the WCF service is working.  Just this one call does not get the parameters correctly.</p>
  
  <p>Following is the PHP code that calls it:  </p>
  
  <pre><code>$getPercentComplete_obj-&gt;cpp = array('Course' =&gt; $showcurrentcourse-&gt;CourseIdentifier, 'MediaIndex' =&gt; $mediaIndex, 'Position' =&gt; $position);
  $getPercentComplete_res = $courseService-&gt;CalculatePercentComplete($getPercentComplete_obj);
  $percentComplete = $getPercentComplete_res-&gt;CalculatePercentCompleteResult;
  </code></pre>
  
  <p>Here are the printed parameters from the PHP application:</p>
  
  <pre><code>stdClass Object
  (
      [cpp] =&gt; Array
          (
              [Course] =&gt; BI-0310
              [MediaIndex] =&gt; 5
              [Position] =&gt; 1203.234
          )
  
  )
  stdClass Object
  (
      [CalculatePercentCompleteResult] =&gt; -1
  )
  </code></pre>
  
  <p>As you see here, in the PHP application the data for the parameter is present.
  Been looking at this for many hours, cannot seem to find the problem.</p>
  
  <p>FYI: the following is the method that is called by this method above.  I had tried this too using the <code>$param_obj-&gt;courseID = $courseID</code> for the individual parameters and the string parameter always came across as empty.  That is why I created the method that takes the "CoursePercentParam" class.
  Anyway, here is that code:</p>
  
  <pre><code>    [OperationBehavior(ReleaseInstanceMode = ReleaseInstanceMode.AfterCall)]
      int ICatalogService.CalculateCoursePercentComplete(string courseID, int mediaIndex, double position)
      {
          Trace.TraceInformation("courseID=&gt;'{0}', mediaIndex=&gt;'{1}', position=&gt;'{2}'",
              courseID, mediaIndex, position);
  
          Course course = ((ICatalogService)this).GetCourse(courseID);
          if (null == course)
              return -1;
  
          double current = ((ICatalogService)this).CalculateCourseProgress(courseID, mediaIndex, position);
          double total = ((ICatalogService)this).GetCourseLength(course);
  
          int percent = (int)((current / total) * 100);
          Trace.TraceInformation("Percent Complete: {0}", percent);
          return percent;
      }
  </code></pre>
  
  <p>I would appreciate any help I can get.</p>
  
  <p>Thank you,
  Jim</p>