NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Urgent: need help on serialization issue


Joined: 03 Apr 2007
Posts: 2
Reply with quote
Hi all,

For a week now I have been searching every nusoap-entry I could google, but without result.
A hint as to where to look to find te correct settings would be very much appreciated.

the rrormessage my .NET customer reports is: 'unable to serialize result'

I am trying to create a webservice, the wsdl generated from my php code is:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:82.169.209.104/DV-SMS/DV-SMS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:82.169.209.104/DV-SMS/DV-SMS">
<types><xsd:schema targetNamespace="urn:82.169.209.104/DV-SMS/DV-SMS"
>
 <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
 <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
 <xsd:complexType name="SendSMS">
  <xsd:all>
   <xsd:element name="MessageID" type="s:long" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="SMSNumber" type="s:long" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="DVSender" type="s:long" minOccurs="1" maxOccurs="1"/>

   <xsd:element name="Message" type="s:string" minOccurs="0" maxOccurs="1"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendSMSResponse">
  <xsd:all>
   <xsd:element name="SendSMSResult" type="s:string" minOccurs="0" maxOccurs="1"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendErrorMessage">

  <xsd:all>
   <xsd:element name="MessageID" type="s:long" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="SMSNumber" type="s:long" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="ErrorMsgID" type="s:long" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="ErrorCode" type="s:long" minOccurs="1" maxOccurs="1"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendErrorMessageResponse">
  <xsd:all>

   <xsd:element name="SendErrorMessageResult" type="s:string" minOccurs="0" maxOccurs="1"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendSMSRequestType">
  <xsd:all>
   <xsd:element name="name" type="tns:SendSMS"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendSMSResponseType">

  <xsd:all>
   <xsd:element name="return" type="tns:SendSMSResponse"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:complexType name="SendErrorMessageRequestType">
  <xsd:all>
   <xsd:element name="name" type="tns:SendErrorMessage"/>
  </xsd:all>
 </xsd:complexType>

 <xsd:complexType name="SendErrorMessageResponseType">
  <xsd:all>
   <xsd:element name="return" type="tns:SendErrorMessageResponse"/>
  </xsd:all>
 </xsd:complexType>
 <xsd:element name="SendSMS" type="tns:SendSMSRequestType"/>
 <xsd:element name="SendSMSResponse" type="tns:SendSMSResponseType"/>
 <xsd:element name="SendErrorMessage" type="tns:SendErrorMessageRequestType"/>
 <xsd:element name="SendErrorMessageResponse" type="tns:SendErrorMessageResponseType"/>

</xsd:schema>
</types>
<message name="SendSMSRequest"><part name="parameters" type="tns:SendSMS" /></message>
<message name="SendSMSResponse"><part name="parameters" type="tns:SendSMSResponse" /></message>
<message name="SendErrorMessageRequest"><part name="parameters" type="tns:SendErrorMessage" /></message>
<message name="SendErrorMessageResponse"><part name="parameters" type="tns:SendErrorMessageResponse" /></message>
<portType name="DV-SMSPortType"><operation name="SendSMS"><documentation>Accepteert een SMS bericht</documentation><input message="tns:SendSMSRequest"/><output message="tns:SendSMSResponse"/></operation><operation name="SendErrorMessage"><documentation>Accepteert een foutmelding</documentation><input message="tns:SendErrorMessageRequest"/><output message="tns:SendErrorMessageResponse"/></operation></portType>
<binding name="DV-SMSBinding" type="tns:DV-SMSPortType"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="SendSMS"><soap:operation soapAction="urn://82.169.209.104/DV-SMS/DV-SMS.php?SendSMS" style="document"/><input><soap:body use="literal" namespace="urn://82.169.209.104/DV-SMS/DV-SMS.php"/></input><output><soap:body use="literal" namespace="urn://82.169.209.104/DV-SMS/DV-SMS.php"/></output></operation><operation name="SendErrorMessage"><soap:operation soapAction="urn://82.169.209.104/DV-SMS/DV-SMS.php?SendErrorMessage" style="document"/><input><soap:body use="literal" namespace="urn://82.169.209.104/DV-SMS/DV-SMS.php"/></input><output><soap:body use="literal" namespace="urn://82.169.209.104/DV-SMS/DV-SMS.php"/></output></operation></binding>
<service name="DV-SMS"><port name="DV-SMSPort" binding="tns:DV-SMSBinding"><soap:address location="http//82.169.209.104/DV-SMS/DV-SMS.php"/></port></service>
</definitions
>

the PHP code I am using is:

Code:
<?php
// Pull in the NuSOAP code
require_once('/lib/NuSoap/nusoap.php'); // LET OP:soapclient WORDT NuSoapClient
$server = new soap_server();
// SERVER VARIABELEN INSTELLEN
$serviceName = 'DV-SMS';
$namespace = 'urn:82.169.209.104/DV-SMS/DV-SMS';
$endpoint = 'http//82.169.209.104/DV-SMS/DV-SMS.php';
$style = 'document';
$transport = 'http://schemas.xmlsoap.org/soap/http';

//TE GEBRUIKEN PHP VARIABELEN DEFINIEREN
//SENDSMS
// $MessageID;
// $SMSNumber;
// $DVSender;
// $Message;
// $SendSMS = array('MessageID'=>$MessageID, 'SMSNumber'=>$SMSNumber, 'DVSender'=>$DVSender, 'Message'=>$Message);

//SENDSMSRESPONSE
// $SendSMSResult;
// $SendSMSResponse = array('SendSMSResult'=>$SendSMSResult);

//SENDERRORMESSAGE
// $ErrorMsgID;
// $Errorcode;
// $SendErrorMessage =  array('MessageID'=>$MessageID, 'SMSNumber'=>$SMSNumber, 'ErrorMsgID'=>$ErrorMsgID, 'Errorcode'=>$Errorcode);

//SENDERRORMESSAGERESPONSE
// $SendErrorMessageResult;
// $SendErrorMessageResponse = array('SendErrorMessageResult'=>$SendErrorMessageResult);

//OP DE EEN OF ANDERE MANIER MOET IK VOOR IK DE COMPLEXE VARIABELEN DEFINIEER, ZE EERST DECLAREREN IN WSDL?

class SendSMS
{
    var $MessageID;
    var $SMSNumber;
    var $DVSender;
    var $Message;
   function SendSMS ($SendSMS)
   {
   if($SendSMS)
   {
   $SendSMSResponse= $SendSMS['MessageID'] . $SendSMS['SMSNumber'] . $SendSMS['DVSender'] . $SendSMS['Message'] . '<br>Het SMS-bericht is ontvangen en wordt verstuurd!';
     }
    return $SendSMSResponse;
   }

}

class SendErrorMessage
{
    var $MessageID;
    var $SMSNumber;
    var $ErrorMsgID;
    var $ErrorCode;
   function SendErrorMessage ($SendErrorMessage)
   {
   if($SendErrorMessage)
   {
   $SendErrorMessageResponse=$SendErrorMessage['MessageID'] . $SendErrorMessage['SMSNumber'] . $SendErrorMessage['ErrorMsgID'] . $SendErrorMessage['ErrorCode'] . '<br>De Foutmelding is ontvangen en wordt verwerkt.';
   }
   return $SendSMSResponse;
   }
   
}

//SERVER INITIEREN
//configureWSDL($serviceName, $namespace, $endpoint ,$style, $transport);
$server->configureWSDL($serviceName, $namespace, $endpoint, $style, $transport);
//$server->configureWSDL('DV-SMS', 'urn://82.169.209.104/DV-SMS/DV-SMS.php');
////
//OP DE EEN OF ANDERE MANIER MOET IK VOOR IK DE COMPLEXE VARIABELEN DEFINIEER, ZE EERST DECLAREREN IN WSDL?
// ADD PARAMETER OFZO
//
//
//
// DEFINIEREN VAN DE 4 COMPLEXE TYPEN VARIABELEN
// SendSMS
$server->wsdl->addComplexType(
   'SendSMS',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'MessageID' => array('name'=>'MessageID', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'SMSNumber' => array('name'=>'SMSNumber', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'DVSender' => array('name'=>'DVSender', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'Message' => array('name'=>'Message', 'type'=>'s:string', 'minOccurs'=>'0', 'maxOccurs'=>'1')
   )
);

// SendSMSResponse
$server->wsdl->addComplexType(
   'SendSMSResponse',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'SendSMSResult' => array('name'=>'SendSMSResult', 'type'=>'s:string', 'minOccurs'=>'0','maxOccurs'=>'1'),
   )
);

// SendErrorMessage
$server->wsdl->addComplexType(
   'SendErrorMessage',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'MessageID' => array('name'=>'MessageID', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'SMSNumber' => array('name'=>'SMSNumber', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'ErrorMsgID' => array('name'=>'ErrorMsgID', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1'),
      'ErrorCode' => array('name'=>'ErrorCode', 'type'=>'s:long', 'minOccurs'=>'1', 'maxOccurs'=>'1')
   )
);

// SendErrorMessageResponse
$server->wsdl->addComplexType(
   'SendErrorMessageResponse',
   'complexType',
   'struct',
   'all',
   '',
   array(
      'SendErrorMessageResult' => array('name'=>'SendErrorMessageResult', 'type'=>'s:string', 'minOccurs'=>'0','maxOccurs'=>'1'),
   )
);

//REGISTREREN VAN DE 2 SERVICES
//EEN) SENDSMS
$server->register('SendSMS',                                  // method name
    array('name' => 'tns:SendSMS'),                        // input parameters
    array('return' => 'tns:SendSMSResponse'),                  // output parameters
   'urn://82.169.209.104/DV-SMS/DV-SMS.php',               // namespace
   'urn://82.169.209.104/DV-SMS/DV-SMS.php?SendSMS',       // soapaction
   'document',                                                        // style
   'literal',                                                 // use
    'Accepteert een SMS bericht'                                 // documentation
);

//TWEE) SENDERRORMESSAGE
$server->register('SendErrorMessage',                            // method name
    array('name' => 'tns:SendErrorMessage'),                     // input parameters
    array('return' => 'tns:SendErrorMessageResponse'),               // output parameters
   'urn://82.169.209.104/DV-SMS/DV-SMS.php',               // namespace
   'urn://82.169.209.104/DV-SMS/DV-SMS.php?SendErrorMessage',    // soapaction
    'document',                                                           // style
    'literal',                                                    // use
    'Accepteert een foutmelding'                                 // documentation
);


// GEREGISTREERDE NAAM VAN DE SERVICE MOET HETZELFDE ZIJN ALS DE FUNCTIENAAM


// request gebruiken om de dienst te activeren. Of een poging daartoe.
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA :'';
$server->service($HTTP_RAW_POST_DATA);



include('dinges.php');
$requestDump = htmlspecialchars($HTTP_RAW_POST_DATA);
$sql = "INSERT INTO `DV` ( `rownumber`,`MessageID` , `SMSNumber` , `Message` , `ErrorMsgID` , `Errorcode` , `SendSMSResult` , `SendErrorMessageResult`, `requestDump`)
   VALUES ('', '" . $SendSMS['MessageID'] . "',  '" .
      $SendSMS['SMSNumber'] . "',  '" .
      $SendSMS['Message'] . "',  '" .
      $SendSMS['ErrorMsgID'] . "',  '" .
      $SendSMS['Errorcode'] . "',  '" .
      $SendSMS['SendSMSResult'] . "',  '" .
      $SendSMS['SendErrorMessageResult'] . "',  '" .
      $requestDump.
"');";
$sqlResult = mysql_query($sql, $connection);
?>


If anyone could be so kind as to point me in the right direction, it would be very much appreciated!

Kind regards,
Dirk
View user's profileFind all posts by DirkSend private message


Joined: 03 Apr 2007
Posts: 2
Reply with quote
BTW The service I am supposed to be mirroring, shows the wsdl for the complex types like this:

Code:
<s:schema elementFormDefault="qualified" targetNamespace="http://www.DirectVeilen.nl/SMS/">

   <s:element name="ReceiveSMSMessage">

   <s:complexType>

   <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="MessageID" type="s:long"/>
<s:element minOccurs="1" maxOccurs="1" name="SMSNumber" type="s:long"/>
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element
>

Which is very different from the wsdl generated by my server:

Quote:
<definitions targetNamespace="urn:82.169.209.104/DV-SMS/DV-SMS">

<types>

<xsd:schema targetNamespace="urn:82.169.209.104/DV-SMS/DV-SMS">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>

<xsd:complexType name="SendSMS">

<xsd:all>
<xsd:element name="MessageID" type="s:long" minOccurs="1" maxOccurs="1"/>
<xsd:element name="SMSNumber" type="s:long" minOccurs="1" maxOccurs="1"/>
<xsd:element name="DVSender" type="s:long" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Message" type="s:string" minOccurs="0" maxOccurs="1"/>
</xsd:all>


I have the feeling that the key to my problem is to find a php command that will generate the <s:sequence> tag, but I am totally stumped.
View user's profileFind all posts by DirkSend private message
Urgent: need help on serialization issue
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic