PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 25th, 2004, 12:49 PM
jtp51 jtp51 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Omaha, Nebraska
Posts: 63 jtp51 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 5 sec
Reputation Power: 9
NuSOAP: How do you pass in a complex type to a client utilizing SOAP Request?

The following WSDL SOAP Request "ReceiverMenuDeleteRequest" requires the element named "Authentication" and "TID".

With "TID"; I believe I can pass in a string value like:
Code:
array('TID'=>'06000C18')


However, how do I pass values to the complexType "Authentication"?

Currently, I have it set-up as:
Code:
$Authentication = array('RqstAppl'=>'CMDLINK', 'RqstApplVers'=>'1.00', 'Client'=>'KBREQ', 'User'=>'OPSSUPPORT', 'Pswd'=>'ENCRYPTED');

$result = $client->call('ReceiverMenuDeleteRequest', array('TID'=>'06000C18', 'Authentication'=>$Authentication));



The errors I keep receiving are:
Quote:
1. Response Envelope: Error: HTTP Error: socket read of headers timed out

2. My Request SOAP envelope is not filled in:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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:si="http://soapinterop.org/xsd" xmlns:ns6="http://soap.dtn.com">
<SOAP-ENV:Body>
<ns6:ReceiverMenuDeleteRequest xmlns:ns6="http://soap.dtn.com">
<ReceiverMenuDeleteRequest xsi:nil="true"/>
</ns6:ReceiverMenuDeleteRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Below is a snippet of the WSDL and the full PHP code that I use to call the WSDL.

Thank you for reading this post.

--Todd Patrick

WSDL:
Code:
<xsd:complexType name="Authentication">
	<xsd:sequence>
	<!-- Request Application -->
	<xsd:element maxOccurs="1" minOccurs="1" name="RqstAppl" type="xsd:string"/>
	<!-- Request Application Version -->
	<xsd:element maxOccurs="1" minOccurs="1" name="RqstApplVers" type="xsd:string"/>
	<!-- Client using Request Application -->
	<xsd:element maxOccurs="1" minOccurs="1" name="Client" type="xsd:string"/>
	<!-- Client's User using Request Application -->
	<xsd:element maxOccurs="1" minOccurs="1" name="User" type="xsd:string"/>
	<!-- Client's User Password (Encrypted) -->
	<xsd:element maxOccurs="1" minOccurs="1" name="Pswd" type="xsd:string"/>
	</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ReceiverMenuDeleteRequest">
	<xsd:sequence>
		<xsd:element
			maxOccurs="1"
			minOccurs="1"
			name="AuthInfo"
			nillable="true"
			type="color1:Authentication"/>
		<xsd:element maxOccurs="1" minOccurs="1" name="TID" type="xsd:string"/>
	</xsd:sequence>
</xsd:complexType>


PHP:
Code:
<?
require_once('nusoap.php');

$wsdl = 'http://color-app-dev.eng.dtn.com/ColorSystemInterface.wsdl';
$client=new soapclient($wsdl, true);

$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
// Call the SOAP method
$Authentication = array('RqstAppl'=>'CMDLINK', 'RqstApplVers'=>'1.00', 'Client'=>'KBREQ', 'User'=>'OPSSUPPORT', 'Pswd'=>'ENCRYPTED');


$result = $client->call('ReceiverMenuDeleteRequest', array('TID'=>'06000C18', 'Authentication'=>$Authentication));
// Check for a fault
if ($client->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    // Check for errors
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
    } else {
        // Display the result
        echo '<h2>Result</h2><pre>';
        print_r($result);
    echo '</pre>';
    }
}
echo 'Web Service: Color System Interface ReceiverMenuDeleteRequest<br>';
echo 'WSDL: '.$wsdl.'<br>';
echo 'Parameters: ';
print_r($param);
echo '<br><br>Response Envelope: ';
if(!$err = $client->getError()){
	print_r($response);
} else {
	print 'Error: '.$err;
}
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
?>
__________________
--Todd

Reply With Quote
  #2  
Old October 26th, 2004, 12:30 PM
UnseenForces UnseenForces is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Dallas, TX
Posts: 944 UnseenForces User rank is Private First Class (20 - 50 Reputation Level)UnseenForces User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 48 m 58 sec
Reputation Power: 9
Your code looks fine.

Creating a sub-array indexed for the "complex" type is correct.

What version of NuSOAP are you using?

You may want to go to sourceforge.net and checkout the lastest version of nusoap.php from CVS.

http://sourceforge.net/projects/nusoap/

(sourceforge.net is down for maintainance right now, or I would give you the full link to the CVS)
__________________
Pay no attention to the person behind the curtain.

Reply With Quote
  #3  
Old October 26th, 2004, 01:29 PM
jtp51 jtp51 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Omaha, Nebraska
Posts: 63 jtp51 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 27 m 5 sec
Reputation Power: 9
UnseenForces: Thank you for the feedback.

I am using version nusoap.php,v 1.81.

I will check out the latest version of nusoap.php from CVS.

Have you tried to create a sub-array for the 'complex' type?

Reply With Quote
  #4  
Old October 26th, 2004, 01:41 PM
UnseenForces UnseenForces is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Dallas, TX
Posts: 944 UnseenForces User rank is Private First Class (20 - 50 Reputation Level)UnseenForces User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 48 m 58 sec
Reputation Power: 9
Yes. I test all my SOAP services with a generic NuSOAP client that uses an index array for the "complex" type.

Just make sure all the names/capitals are the same an it works great.

Reply With Quote
  #5  
Old May 28th, 2009, 08:11 AM
dsho dsho is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Singapore
Posts: 9 dsho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 50 sec
Reputation Power: 0
Hi all,

I am having a similar issue passing in the array to NuSOAP as well.

Came across Scott Nicol's tutorial indicating the same method but the XML packet still shows an "empty" parameter.

Here is a snippet of the WSDL in question :

<xsd:complexType name="ArrayOfSMSContent">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="sms_content" nillable="true" type="tns:SMSContent" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SMSContent">
<xsd:sequence>
<xsd:element name="content" nillable="false" type="xsd:string" />
<xsd:element name="ucp_data_coding_id" nillable="false" type="xsd:string" />
<xsd:element name="ucp_msg_class" type="xsd:string" />
<xsd:element name="ucp_msg_type" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<xsd:element name="SmsMt">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="status" type="xsd:int" />
<xsd:element name="notification_ind" type="xsd:int" />
<xsd:element name="sms_contents" nillable="false" type="tns:ArrayOfSMSContent" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

My PHP code is similar to the original post :

$sms_content = array('content' => 'test vsdb', 'ucp_data_coding_id' => '', 'ucp_msg_class' => '', 'ucp_msg_type' => '3');

$result = $client->call('SmsMt', array('status' => '1', 'notification_ind' => '0', array('sms_contents' => $sms_content)));

Server reply is there is no valid "sms_contents" parameter. XML packet shows :

<sms_contents></sms_content></sms_contents>

Any help is appreciated.

Thanks you.

DSHo

Reply With Quote
  #6  
Old June 2nd, 2009, 08:44 AM
dsho dsho is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Singapore
Posts: 9 dsho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 50 sec
Reputation Power: 0
Quote:
Originally Posted by dsho
My PHP code is similar to the original post :

$sms_content = array('content' => 'test vsdb', 'ucp_data_coding_id' => '', 'ucp_msg_class' => '', 'ucp_msg_type' => '3');

$result = $client->call('SmsMt', array('status' => '1', 'notification_ind' => '0', array('sms_contents' => $sms_content)));


Hi all,

I accidently solved it by declaring an array of an array and plug it in the call() above :

$sms_content2 = array('content' => 'test vsdb', 'ucp_data_coding_id' => '', 'ucp_msg_class' => '', 'ucp_msg_type' => '3');

$sms_content = array('sms_content' => $sms_content2);

$result = $client->call('SmsMt', array('status' => '1', 'notification_ind' => '0', array('sms_contents' => $sms_content)));

Now, to write a web service to capture the response of the above call...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > NuSOAP: How do you pass in a complex type to a client utilizing SOAP Request?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap