It's been many, many years since I have written any ASP code and I dont recall this functionality being present in the past BUT:

In php we have a serialize() that takes an array of data and creats a single string representation of that data. The single string can then be passed as a parameter to a function (e.g. a SOAP server) and then run through an unserialize() which puts the data back in array form.

Does ASP and .NET support this and does anyone know if its compatible with php?

Just as a point of reference, our existing php client side code looks like this and we need to know if this will work in an ASP and/or .NET enviorment

<?php 
  $wsdl = "http://ddomain.com/dist/alarms/nwaAlarms.wsdl";
  $soap = new SoapClient($wsdl);
  
  // returns a 128 byte token or a single char error code
  $sessid = $soap->nwaLogin("demo", "demo");
  switch($sessid)
  {
    case "0":
      die("Remote login failed: invalid userid/passord!");
      break;
      
    case "5":
      die("Session timed out, token no longer valid!");
      
    case "";
      die("NULL response from soap server!");
      break;
      
    default:
      // we got back a 128 byte token
      echo "Logged in! Session ID: $sessid<br>"; 
  }
  $police = "N";
  $injury = "N";
  $damage = "Y";
  $occured = "2010-12-04";
  $message_text = "SOAP client entry no lat/lon";
  $address = "1600 Amphitheatre Parkway";
  $city = "Mountain View";
  $state = "CA"; 
  $zip = "94043";
  $lat = '';
  $lon = '';
  $message = serialize(array($police, $injury, $damage, $occured, $message_text, $address, $city, $state, $zip, $lat, $lon));

  $result = $soap->nwaAlarm($sessid, $message);
  echo "<br>Server Response: $result<br>";
?>

>Does ASP and .NET support this and does anyone know if its compatible with php?

Yeah! Here it is. http://sourceforge.net/projects/csphpserial/

Absolutely awesome! Thanks!

There are all sorts of issues passing complex data types between .NET clients and PHP soap servers and I think this method will eliminate virtually all of them for us.

Is that really "SOAP-y", though? Does your PHP service produce WSDL? Using WCF, you can add service references that will do strongly-typed objects to send over the line to a SOAP service.

Is that really "SOAP-y", though? Does your PHP service produce WSDL? Using WCF, you can add service references that will do strongly-typed objects to send over the line to a SOAP service.

Question: Do you want it to work or do you want it to be right? LOL

I have found dozens of comments like this one:

Calling a server from .NET:
If you intend to call a PHP SOAP server from a .NET Client, there are a couple of things to be aware of. First of all, I've only got it working in WSDL mode. If anyone have made it work in non-WSDL-mode, I'd be interested in hearing that. In WSDL-mode it works, but both input and output-parameters are wrapped from .NET.

Basically, a function with this signature:

<?php
function SomeFunction($param1, $param2)
{
return $param1+$param2;
}
?>

Must be rewritten to this, without changing the WSDL:

<?php
function SomeFunction($data)
{
$valueArray = get_object_vars($data);
$param1 = $valueArray["param1"];
$param2 = $valueArray["param2"];
return Array("SomeFunctionResult" => $param1+$param2);
}
?>

http://www.php.net/manual/en/soapserver.soapserver.php
So how do you write a SOAP server that serves php, jsp, .net and what ever else for clients and then check for all the different ways the various clients muck with the passed parameters?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.