Jump to content

Recommended Posts

Here is the code:

 

$client = new

    SoapClient(

        "xyz.wsdl"

    );

 

print ($client->getDocument("XGRRT2AMSU", "all", "avjx", array("all"), "ose"));

 

Basically I need to pass this array - ["all"] as an argument, I copied it from a perl script but PHP is trying to find the value of "all", how can I pass the array as an argument?

 

Many Thanks,

 

you can pass an array to a function in php just fine:

 

function blah ($array) {
  echo "<pre>";
  print_r($array);
}
$x = array('a','b','c');
blah($x);

 

output:

Array
(
    [0] => a
    [1] => b
    [2] => c
)

 

are you sure you are passing it in the right place?  what does your getDocument method look like?

Here is the example Perl script (presumably correct as it was provided by the Web Department)  that I was trying to convert to php:

 

# Call the doSearch() method on the SOAP client.

my $result = $soap->getDocument("B18U1T6JID",  # Your SOAP key

                                "all",  # The name of the KB to use,

                                $docid, # The docid of the KB document.

                                ["all"], # The doc. domains we limit to.

                                "ose"); # The audience we use for titles, etc.

 

Here is the outline of the method:

 

getDocument(string authKey, string whichKB, string docId, array domains, string audience)

 

Return the document docId. whichKB is the domain class you need. domains is a list of strings, naming the domains you can use when accessing this document. audience is the group to whom this document is being presented.

 

 

 

For example if I use this code:

 

$x = array("all");

 

$client = new 

    SoapClient(

        "xyz.wsdl"

    );

 

print ($client->getDocument("XGRRT2AMSU", "all", "avjx", $x, "ose"));

 

I get the following error:

 

Catchable fatal error: Object of class stdClass could not be converted to string

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.