WCF service with PHP client - complex type as parameter not working

Posted by Matt F on Stack Overflow See other posts from Stack Overflow or by Matt F
Published on 2009-01-28T17:17:38Z Indexed on 2010/05/03 6:18 UTC
Read the original article Hit count: 332

Filed under:
|
|

Hi,

I have a WCF service with three methods. Two of the methods return custom types (these work as expected), and the third method takes a custom type as a parameter and returns a boolean. When calling the third method via a PHP soap client it returns an 'Object reference not set to an instance of an object' exception.

Example Custom Type:

_ Public Class MyClass

Private _propertyA As Double
<DataMember()> _
Public Property PropertyA() As Double
    Get
        Return _propertyA
    End Get
    Set(ByVal value As Double)
        _propertyA = value
    End Set
End Property

Private _propertyB As Double
<DataMember()> _
Public Property PropertyB() As Double
    Get
        Return _propertyB
    End Get
    Set(ByVal value As Double)
        _propertyB = value
    End Set
End Property

Private _propertyC As Date
<DataMember()> _
Public Property PropertyC() As Date
    Get
        Return _propertyC
    End Get
    Set(ByVal value As Date)
        _propertyC = value
    End Set
End Property

End Class

Method:

Public Function Add(ByVal param As MyClass) As Boolean Implements IService1.Add ' ... End Function

PHP client call:

$client->Add(array('param'=>array( 'PropertyA' => 1, 'PropertyB' => 2, 'PropertyC' => "2009-01-01" )));

The WCF service works fine with a .Net client but I'm new to PHP and can't get this to work.

Is it possible to create an instance of 'MyClass' in PHP.

Any help would be appreciated.

Note: I'm using PHP 5 (XAMPP 1.7.0 for Windows).

Thanks

Matt

© Stack Overflow or respective owner

Related posts about wcf

Related posts about .NET