Reputation: 2448
I have SOAP wsdl from Magento and I have to get simple product list from it. Logic is to get 'simple' products from catalogProductList.
So far in VS2015 I have create console app, and in reference add service reference, paste url of wsdl, but further I have no idea what to do, also didn't find any similar examples.
In PHP code would be like this:
$proxy = new SoapClient('http://magentowebshop/api/v2_soap/?wsdl');
$sessionId = $proxy->login('user', 'pass');
$complexFilter = array(
'complex_filter' => array(
array(
'key' => 'type',
'value' => array('key' => 'in', 'value' => 'simple')
)
)
);
$result = $proxy->catalogProductList($sessionId, $complexFilter);
var_dump($result);
Upvotes: 0
Views: 492
Reputation: 2448
Ok i find a solution:
ServiceReference1.PortTypeClient client = new
ServiceReference1.PortTypeClient();
string sessionID = client.login("user", "pass");
filters filter = new filters();
filter.complex_filter = new[]
{
new complexFilter
{
key = "type",
value = new associativeEntity { key = "in", value = "simple"}
}
};
var list = client.catalogProductList(sessionID, filter, "catalog");
client.endSession(sessionID);
Upvotes: 0
Reputation: 10862
When you added the serviceReference it asked you to input a NameSpace
In your code use that namespace to create a client a be able to call the exposed methods of the WSDL
private void testMethod
{
ServiceReference1.ExampleClient client ;
client = new ServiceReference1.ExampleClient();
client.exampleMethod() ;
}
when you type ServiceReference1.
you will see a list of the clients created based on the wsdl that you added.
and then when you type client.
you will see methods that you can get to achieve what you want
Upvotes: 1