Jump to content

printing results from web service (SoapClient)


irandoct

Recommended Posts

Hi,

i'm writing a webservice for my application. i can't print and save result of webservice.

my php code:

 <?php
....     
$client = new SoapClient("http://addresst/code.asmx?wsdl");
        $params = array(
            'Username'=>$username,
            'PassWord'=>$password,
			'numberOfMessages'=>$numberOfMessages,
			'destNumber'=>$destNumber,
			'ErrNum'=>$ErrNum,
        );
        $result = $client->GetAllMessages( $params );
        if (is_soap_fault($result)) {
        echo '<h2>Fault:</h2><pre>';
        print_r($result);
       echo '</pre>';
       } else {
	   print_r($result); //testing output
	   echo "<hr/>";
	   $res = $result->GetAllMessagesResult;//testing output
       print_r($res);
		//end get messages
	    }
?>

xml schema:

<s:element name="GetAllMessages"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string"/><s:element minOccurs="0" maxOccurs="1" name="PassWord" type="s:string"/><s:element minOccurs="1" maxOccurs="1" name="numberOfMessages" type="s:int"/><s:element minOccurs="0" maxOccurs="1" name="destNumber" type="s:string"/><s:element minOccurs="1" maxOccurs="1" name="ErrNum" type="s:int"/></s:sequence></s:complexType></s:element><s:element name="GetAllMessagesResponse"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="GetAllMessagesResult" type="tns:ArrayOfArrayOfString"/><s:element minOccurs="1" maxOccurs="1" name="ErrNum" type="s:int"/></s:sequence></s:complexType></s:element><s:complexType name="ArrayOfArrayOfString"><s:sequence><s:element minOccurs="0" maxOccurs="unbounded" name="ArrayOfString" nillable="true" type="tns:ArrayOfString"/></s:sequence></s:complexType>

what's wrong?

please post your code based on XML schema i posted here!

Regards

Mansour

Edited by irandoct
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.