Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6885161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:36:00+00:00 2026-05-27T05:36:00+00:00

I’m trying to use magento shopping platform API from .NET and it is not

  • 0

I’m trying to use magento shopping platform API from .NET and it is not so sweet, as I imagined.
Thing is main method has args parameter which in .net generated client is an object and in soap envelope producted by php sample looks like this:

 <args SOAP-ENC:arrayType="xsd:ur-type[4]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">simple</item>
    <item xsi:type="xsd:int">4</item>
    <item xsi:type="xsd:string">sku_of_product</item>
    <item xsi:type="ns2:Map">
      <item>
        <key xsi:type="xsd:string">name</key>
        <value xsi:type="xsd:string">name of product</value>
      </item>
      <item>
        <key xsi:type="xsd:string">short_description</key>
        <value xsi:type="xsd:string">short description</value>
      </item>
      <item>
        <key xsi:type="xsd:string">description</key>
        <value xsi:type="xsd:string">description</value>
      </item>
      <item>
        <key xsi:type="xsd:string">status</key>
        <value xsi:type="xsd:int">1</value>
      </item>
      <item>
        <key xsi:type="xsd:string">weight</key>
        <value xsi:type="xsd:int">0</value>
      </item>
      <item>
        <key xsi:type="xsd:string">tax_class_id</key>
        <value xsi:type="xsd:int">1</value>
      </item>
      <item>
        <key xsi:type="xsd:string">categories</key>
        <value SOAP-ENC:arrayType="xsd:int[1]" xsi:type="SOAP-ENC:Array">
          <item xsi:type="xsd:int">3</item>
        </value>
      </item>
      <item>
        <key xsi:type="xsd:string">price</key>
        <value xsi:type="xsd:float">12.05</value>
      </item>
    </item>
  </args>

Problem is, that root element is array, which has some string type elements, then some key value pairs, some of those key value pairs values are arrays.
How to describe object in c# to produce such hierarchy?

Update: Service reference does not describe any sructures, just interface.

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="urn:Magento", ConfigurationName="EpcServiceReference.Mage_Api_Model_Server_HandlerPortType")]
public interface Mage_Api_Model_Server_HandlerPortType {

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="callReturn")]
    object call(string sessionId, string resourcePath, object args);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="multiCallReturn")]
    object[] multiCall(string sessionId, object[] calls, object options);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="endSessionReturn")]
    bool endSession(string sessionId);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="loginReturn")]
    string login(string username, string apiKey);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="startSessionReturn")]
    string startSession();

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="resourcesReturn")]
    object[] resources(string sessionId);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="globalFaultsReturn")]
    object[] globalFaults(string sessionId);

    [System.ServiceModel.OperationContractAttribute(Action="urn:Mage_Api_Model_Server_HandlerAction", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
    [return: System.ServiceModel.MessageParameterAttribute(Name="resourceFaultsReturn")]
    object[] resourceFaults(string resourceName, string sessionId);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface Mage_Api_Model_Server_HandlerPortTypeChannel : MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType, System.ServiceModel.IClientChannel {
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class Mage_Api_Model_Server_HandlerPortTypeClient : System.ServiceModel.ClientBase<MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType>, MagentoTest.EpcServiceReference.Mage_Api_Model_Server_HandlerPortType {

    public Mage_Api_Model_Server_HandlerPortTypeClient() {
    }

    public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName) : 
            base(endpointConfigurationName) {
    }

    public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName, string remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public Mage_Api_Model_Server_HandlerPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public Mage_Api_Model_Server_HandlerPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(binding, remoteAddress) {
    }

    public object call(string sessionId, string resourcePath, object args) {
        return base.Channel.call(sessionId, resourcePath, args);
    }

    public object[] multiCall(string sessionId, object[] calls, object options) {
        return base.Channel.multiCall(sessionId, calls, options);
    }

    public bool endSession(string sessionId) {
        return base.Channel.endSession(sessionId);
    }

    public string login(string username, string apiKey) {
        return base.Channel.login(username, apiKey);
    }

    public string startSession() {
        return base.Channel.startSession();
    }

    public object[] resources(string sessionId) {
        return base.Channel.resources(sessionId);
    }

    public object[] globalFaults(string sessionId) {
        return base.Channel.globalFaults(sessionId);
    }

    public object[] resourceFaults(string resourceName, string sessionId) {
        return base.Channel.resourceFaults(resourceName, sessionId);
    }
}

and I’m trying to call this method:

    object call(string sessionId, string resourcePath, object args);

also I found similar question here, sadly it does not have an answer also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:36:01+00:00Added an answer on May 27, 2026 at 5:36 am

    I’ve found it, hope it will help to anybody, who will have to integrate through php webservices, that expect php arrays:

    [SoapType(TypeName = "Map", Namespace = "http://xml.apache.org/xml-soap")]
    public class item
    {
        [XmlElement(Form = XmlSchemaForm.Unqualified)]
        public string key { get; set; }
    
        [XmlElement(Form = XmlSchemaForm.Unqualified)]
        public string value { get; set; }
    
        [XmlArray("item")]
        [XmlArrayItem(typeof(item), ElementName = "item")]
        public item[] items { get; set; }
    }
    

    Usually php webservices do not specify what kind of types they expect (at least that was in my case), so don’t forget to add your type as a known type to your client operations:

            foreach (var operation in client.Endpoint.Contract.Operations)
            {
                operation.KnownTypes.Add(typeof(item));               
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.