NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
nusoap and document/literal style


Joined: 20 Apr 2008
Posts: 2
Reply with quote
Hi ,all
l'd like to generate wsdl using document/literal style also l'd like to have wsdl element like type, message, binding ,... with know prefix like wsdl:message


thanks
View user's profileFind all posts by melsawySend private message


Joined: 21 Apr 2008
Posts: 10
Reply with quote
Hi,

mention document and literal in "register" line.
Code:

$server->register
    (
        "YOURMETHOD",
        array('Server' => 'INTYPE'),
        array('status' => 'OUTTYPE'),
        'http://localhost/URL/',
        'http://localhost/URL/#YOURMETHOD,                   
        'document',                                   
        'literal',                               
        'A Method to Add Server'
    );


(Replace capitals with actual values).

Use addComplexType and addSimpleType for your elements, Once you register all of them you will see some entries in types, message, binding etc.

If you want some specific prefix then there is something that you can do it by modifying "$namespaces" variable in nusoap.php. I am not very sure about prefix part but this what I know. I would be interested to know further on this if anything else is there.

Regards,

Dave
View user's profileFind all posts by naimish_hitSend private message


Joined: 28 Apr 2008
Posts: 4
Reply with quote
I have the same problem. Here is my full code
index.php
Code:
<?php
require('lib/nusoap.php');
$server = new nusoap_server();
$server->configureWSDL('doclit', '', false, 'document');
$server->wsdl->AddElement(array('name' => 'return', 'type' => 'xsd:string'));
$server->register(
        'sayHello',                                     // name
        array(),                                        //in
        array('return' => 'xsd:string'),       // out
        '',                                                // namespace
        '',                                                // soapaction
        'document',                                  // style
        'literal'                                         // use

);

function sayHello() {
        echo 'Hello World';
}

if(!isset($HTTP_RAW_POST_DATA))
        $HTTP_RAW_POST_DATA = file_get_contents('php://input');

$server->service($HTTP_RAW_POST_DATA);
?>

client.php
Code:
<?php
require('lib/nusoap.php');
$client = new nusoap_client('http://localhost/doclit/index.php?wsdl', 'wsdl');
$client->debug_flag = true;
$result = $client->call('sayHello');
if($client->getError()) {
        echo 'error: ' . $client->getError();
}
echo '>>> ' . $result;
?>

And I recieve this error message:
Code:
error: XML error parsing SOAP payload on line 1: Empty document

What do think is wrong? Am I missing something? Thanks in advance.
View user's profileFind all posts by tristanSend private message
nusoap and document/literal style
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