#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Printing results from web service (SoapClient)


    Hi,

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

    my php code:
    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:
    Code:
    <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
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Originally Posted by irandoct
    what's wrong?
    You tell us. Your code must do something, so what is that? Do you get an error? Which branch of the if statement gets executed? What does the print_r() say?

    If you want us to help you, we first need to know what's going on.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo