Shashikumar Misal
Shashikumar Misal

Reputation: 509

Accessing .NET assemblies via COM in PHP

I have a .net Web service Method CheckCustomerLicense, and this method returns a C sharp serialized object, I am calling this method via Soap from PHP.

I am getting the serialized object which is binary formatted and not in XML.

Exactly this is what I am facing: I want to access that data as object in PHP, but to do this I must desirealize it, and since its a .NET object I want to use .NET built in class System.Runtime.Serialization.Formatters.Binary via COM.

But its not working.

When I use class System.Collections.Stack it is working ie .net is getting accessed. But why it doesn't for class System.Runtime.Serialization.Formatters.Binary?

The Code Is Shown Below:

Working...

<?php
 $stack = new COM("System.Collections.Stack");
 $stack->Push(".Net");
  $stack->Push("Hello ");
  echo $stack->Pop() . $stack->Pop();
 ?>

Not Working

 <?php
  $obj = new COM("System.Runtime.Serialization.Formatters.Binary");
 ?>

Please Help....

Upvotes: 2

Views: 151

Answers (1)

nvoigt
nvoigt

Reputation: 77304

You only put the namespace, you need the full class name. The class is called System.Runtime.Serialization.Formatters.Binary.BinaryFormatter (see MSDN).

Sidenote: who decided a webservice serializing via SOAP should send something that is binary serialized? That seems... well... "strange" to put it mildly.

Upvotes: 1

Related Questions