0

hello! i have a function in my C# code that returns a string array.
and when i test my function in WCF Test Client i get

   Name            Value            Type
   (return)        length=4         System.String[]
   [0]             "DE"             System.String
   [1]             "DK"             System.String
   [2]             "NO"             System.String
   [3]             "SE"             System.String

code if i do var_dump on the function

object(stdClass)[2]
  public 'LandsKodComboBoxResult' => 
    object(stdClass)[3]
      public 'string' => 
        array (size=4)
          0 => string 'DE' (length=2)
          1 => string 'DK' (length=2)
          2 => string 'NO' (length=2)
          3 => string 'SE' (length=2)

My code so far

<?php
        $client = new SoapClient("http://localhost:8731/phpwcf/?wsdl");
        var_dump($client->MyFunction());
        $array = $client->MyFunction();
        echo $array[2]
    ?>

*
so how do i create a php string = this return array?

thank you
Dendei.

2
Contributors
4
Replies
8
Views
5 Years
Discussion Span
Last Post by Dendei
0

maybe :P i just want the my return string array
in a php string array

tested

<?php

    $client = new SoapClient("http://localhost:8731/phpwcf/?wsdl");
    var_dump($client->LandsKodComboBox());
    $response = $client->LandsKodComboBox();
    $array = $response->string;
    echo $array[2]

?>

should this work?

i get Notice: Undefined property: stdClass::$string in C:\wamp\www\test\KundGrundUppgifterDesign.php

2

Think I missed one, pretty difficult without being able to test:

$response = $client->MyFunction();
$array = $response->LandsKodComboBoxResult->string;
0

hehe yes everyone makes mistakes. How a person deals with their mistakes is a mark of their character ^^ and you are very helpfull and it works now.
Thank you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.