1
votes

After submitting a form in my PHP application I store some values in an array like this

     if(isset($_POST['submitArticle']))
        {
            $artikel = $_POST['article'];
            $aantal = $_POST['quantity'];
            $a=0;

            $art = array();
            $quan = array();

            foreach($artikel as $key => $value)
            {
                $art[] = $artikel[$a];
                $quan[] = $aantal[$a];

                $a++;
            }
            $artikelArguments = array_combine($art, $quan);

Now I call a method in my C# application with my new array as an argument:

$client->getArticle($artikelArguments);

My method in C# looks something like this:

    public List<string> getArticle(List<KeyValuePair<int, int>> articles)
            {
               //Get articles based on ID
               foreach (KeyValuePair<int, int> art in articles)
               {

Now articles is always null, so the values won't get passed, or C# can't handle my PHP array. Does someone have any suggestions?

Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault]
2
Perhaps it cannot convert it to List<KeyValuePair<int, int>>, I would start by changing it to object and ensure that your c# method gets called.row1
I used object at first since PHP returns lousy variables but my WCF service can't handle that.Matheno
How does the WSDL for the getArticle operation look? Can you post the wsdl:operation tag contains?gfish3000
You mean this? <wsdl:operation name="getArticle"><wsdl:input wsaw:Action="tempuri.org/IIQService/getArticle" message="tns:IIQService_getArticle_InputMessage"/><wsdl:output wsaw:Action="tempuri.org/IIQService/getArticleResponse" message="tns:IIQService_getArticle_OutputMessage"/></wsdl:operation>Matheno

2 Answers

0
votes

I saw that this didnt get a proper answer. For this issue I used objects instead of integers and then it worked fine.

-1
votes

This is not answering directly your question, but whenever I have to make soap calls from php, I use a proxy generator, such as the one you can find there, developped by Przemek Berezowski. It'll handle soap type conversion for you