Click here to Skip to main content
15,886,740 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When I make a post to Magento in PHP with the following code:
PHP
<?php
$options = array(
    'cache_wsdl' => 0,
    'trace' => 1,
    'stream_context' => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    )));
//Url de la conexión
try {
    $client    = new SoapClient("https://prevs.vinoseleccion.com/api/soap/?wsdl=1", $options);
    $session   = $client->login("******", "*****");
    $filter    = array(
        "email" => "carlosbote+2@gmail.com"
    );//Listado de clientes filtrado
    $customers = $client->call($session, "customer.list", array($filter));//Impresión
    print_r($customers);//Logout
    $client->endSession($session);
} catch (SoapFault $e) {
    var_dump($e->getMessage());
}
?>

I get the XML:
XML
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Magento" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:call>
         <sessionId xsi:type="xsd:string">2ed9fd8688a6b4fb2c117b9175bf8fa6</sessionId>
         <resourcePath xsi:type="xsd:string">customer.list</resourcePath>
         <args SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
            <item xsi:type="ns2:Map">
               <item>
                  <key xsi:type="xsd:string">email</key>
                  <value xsi:type="xsd:string">carlosbote+2@gmail.com</value>
               </item>
            </item>
         </args>
      </ns1:call>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


What I have tried:

When I do something similar in C#:
C#
filter= new string[] { "email", "SERGIOBERTOG@GMAIL.COM" };
var result = ObjMag.call(IdSesion, "customer.list", filer);

I get this broken XML:
XML
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   \
   <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      \
      <q1:call xmlns:q1="urn:Magento">
         \
         <sessionId xsi:type="xsd:string">5b8da695b73b814099750c409d49a2d1\</sessionId>
         \
         <resourcePath xsi:type="xsd:string">customer.list\</resourcePath>
         \
         <args href="#id1" />
         \
      </q1:call>
      \
      <q2:Array xmlns:q2="http://schemas.xmlsoap.org/soap/encoding/" id="id1" q2:arrayType="xsd:string[2]">
         \
         <Item>email\</Item>
         \
         <Item>SERGIOBERTOG@GMAIL.COM\</Item>
         \
      </q2:Array>
      \
   </s:Body>
   \
</s:Envelope>
Posted
Updated 6-Aug-20 0:24am
v2
Comments
Sandeep Mewara 6-Aug-20 1:37am    
Seems you are making some service call in C#. How are you doing it? Use 'Improve Question' and update.
Garth J Lancaster 6-Aug-20 2:13am    
I hope the missing 't' is just a typographical error in the second of these two lines (ie 'filer' should be 'filter')

``` filter = new string[] { "email", "SERGIOBERTOG@GMAIL.COM" };
var result = ObjMag.call(IdSesion, "customer.list", filer);```
Richard Deeming 6-Aug-20 6:25am    
There's obviously a mistake in your ObjMag.call code. Since you haven't shared any details of that code with us, we can't tell you what the problem is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900