Get product category IDs from Magento v2.0 SOAP API - magento

How can i get the list of categories a product is a member of, using the Magento v2.0 SOAP web service?
On http://devdocs.magento.com/guides/v2.0/soap/bk-soap.html i found a list of services.
With the catalogProductRepositoryV1, i can request a list or a single product, but it doesn't contain the categories. eg:
Request:
POST http://domain/soap/default?services=catalogProductRepositoryV1 HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8; action="catalogProductRepositoryV1Get"
Host: domain
Content-Length: 382
Expect: 100-continue
Accept-Encoding: gzip, deflate
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<catalogProductRepositoryV1GetRequest xmlns="http://domain/soap/default?services=catalogProductRepositoryV1">
<sku xmlns="">24-MB01</sku>
</catalogProductRepositoryV1GetRequest>
</s:Body>
</s:Envelope>
Response:
HTTP/1.1 200 OK
Date: Fri, 20 May 2016 12:21:46 GMT
Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 PHP/5.6.21
X-Powered-By: PHP/5.6.21
Set-Cookie: PHPSESSID=89fdd89a6caeb8be424b9531c69d6c69; expires=Fri, 20-May-2016 13:21:47 GMT; Max-Age=3600; path=/; domain=domain; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 5547
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Connection: close
Content-Type: application/soap+xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://domain/soap/default?services=catalogProductRepositoryV1">
<env:Body>
<ns1:catalogProductRepositoryV1GetResponse>
<result>
<id>1</id>
<sku>24-MB01</sku>
<name>Joust Duffle Bag</name>
<attributeSetId>15</attributeSetId>
<price>34</price>
<status>1</status>
<visibility>4</visibility>
<typeId>simple</typeId>
<createdAt>2016-01-22 16:28:25</createdAt>
<updatedAt>2016-04-20 09:51:54</updatedAt>
<extensionAttributes/>
<productLinks>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB03</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB05</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB06</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-MB02</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-UB02</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB03</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB07</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
<item>
<sku>24-MB01</sku>
<linkType>upsell</linkType>
<linkedProductSku>24-WB04</linkedProductSku>
<linkedProductType>simple</linkedProductType>
<position/>
<extensionAttributes/>
</item>
</productLinks>
<options/>
<mediaGalleryEntries>
<item>
<id>1</id>
<mediaType>image</mediaType>
<label>Image</label>
<position>1</position>
<disabled>false</disabled>
<types>
<item>image</item>
<item>small_image</item>
<item>thumbnail</item>
</types>
<file>/m/b/mb01-blue-0.jpg</file>
</item>
</mediaGalleryEntries>
<tierPrices/>
<customAttributes>
<item>
<attributeCode>description</attributeCode>
<value><p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.</p>
<ul>
<li>Dual top handles.</li>
<li>Adjustable shoulder strap.</li>
<li>Full-length zipper.</li>
<li>L 29" x W 13" x H 11".</li>
</ul></value>
</item>
<item>
<attributeCode>meta_title</attributeCode>
<value>Joust Duffle Bag</value>
</item>
<item>
<attributeCode>meta_keyword</attributeCode>
<value>Joust Duffle Bag</value>
</item>
<item>
<attributeCode>meta_description</attributeCode>
<value>Joust Duffle Bag <p>The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places t</value>
</item>
<item>
<attributeCode>image</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>small_image</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>thumbnail</attributeCode>
<value>/m/b/mb01-blue-0.jpg</value>
</item>
<item>
<attributeCode>category_ids</attributeCode>
<value>
<xsd:string>3</xsd:string>
<xsd:string>4</xsd:string>
</value>
</item>
<item>
<attributeCode>options_container</attributeCode>
<value>container2</value>
</item>
<item>
<attributeCode>required_options</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>has_options</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>image_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>small_image_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>thumbnail_label</attributeCode>
<value>Image</value>
</item>
<item>
<attributeCode>msrp_display_actual_price_type</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>url_key</attributeCode>
<value>joust-duffle-bag</value>
</item>
<item>
<attributeCode>tax_class_id</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>activity</attributeCode>
<value>11,19,21,22</value>
</item>
<item>
<attributeCode>style_bags</attributeCode>
<value>25,26,29</value>
</item>
<item>
<attributeCode>material</attributeCode>
<value>37,38</value>
</item>
<item>
<attributeCode>strap_bags</attributeCode>
<value>61,62,63,64,65,66</value>
</item>
<item>
<attributeCode>features_bags</attributeCode>
<value>74,76,79</value>
</item>
<item>
<attributeCode>eco_collection</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>performance_fabric</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>erin_recommends</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>new</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>sale</attributeCode>
<value>0</value>
</item>
<item>
<attributeCode>eboekhouden_grootboekrekening</attributeCode>
<value>8000</value>
</item>
<item>
<attributeCode>eboekhouden_costcenter</attributeCode>
<value>0</value>
</item>
</customAttributes>
</result>
</ns1:catalogProductRepositoryV1GetResponse>
</env:Body>
</env:Envelope>

in the product detail SOAP Call i.e. catalogProductRepositoryV1
you will find category_ids as an item in customAttributes tag
<customAttributes>
...
<item>
<attributeCode>category_ids</attributeCode>
<value>
<xsd:string>3</xsd:string>
<xsd:string>4</xsd:string>
</value>
</item>
...
</customAttributes>
than you need to load the categories if you want any information of that from catalogCategoryRepositoryV1

Related

Magento soap error

I'm developing an iOS app that should integrate Magento e-commerce.
Actually I'm trying to put objects into the cart, when I try to do that my app sends to server this WSDL:
<?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>
<call>
<sessionId xsi:type="xsd:string">e976c086bf862d23fcc98e59fb23b499</sessionId>
<resourcePath xsi:type="xsd:string">cart_product.add</resourcePath>
<args xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">quoteId</key>
<value xsi:type="xsd:int">85</value>
</item>
<item>
<key xsi:type="xsd:string">products</key>
<value xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">product_id</key>
<value xsi:type="xsd:string">1</value>
</item>
<item>
<key xsi:type="xsd:string">qty</key>
<value xsi:type="xsd:int">1</value>
</item>
</item>
</value>
</item>
</item>
</args>
</call>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I tried it with this extension for Google Chrome, when I try to run the WSDL
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>1</faultcode>
<faultstring>SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s)</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
What's wrong in my request? Can anyone help me?
Solved now I'm sending this:
<?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>
<call>
<sessionId xsi:type="xsd:string">38fd5af2c7fcfd55884b73ffded29225</sessionId>
<resourcePath xsi:type="xsd:string">cart_product.add</resourcePath>
<args xsi:type="SOAP-ENC:Array">
<item xsi:type="xsd:int">142</item>
<item xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">product_id</key>
<value xsi:type="xsd:string">2</value>
</item>
<item>
<key xsi:type="xsd:string">qty</key>
<value xsi:type="xsd:int">1</value>
</item>
</item>
</item>
</args>
</call>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I was formatting wrong the request, indeed, if you compare the 2 request you will see the difference: I was sending the key "quoteId", but it's not necessary.

Building in-game editor, need assistance with Load and Save

I've been working on a game project with a small group for a bit now and we've hit a block. One of the features of this game is the ability for users to generate their own levels through the use of an in-game editor. The editor creates a Level object which stores the length and width of the level and a two-dimensional array of Tile objects. We've successfully implemented the camera system and can edit together a simple concept level without too much difficulty, but the process of successfully saving the level and loading it back up later is a concept that's proving difficult, and I was hoping one of you could offer some guidance to get the intended functionality down.
In its current state, when the user presses the 'S' key, our LevelManager class runs the SaveLevel method below:
public static void SaveLevel()
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
using (XmlWriter writer = XmlWriter.Create("example.xml", settings))
{
IntermediateSerializer.Serialize(writer, CurrentLevel, null);
}
}
Which serializes our level (CurrentLevel) into an XML file in the project (We'll worry about saving to different files after we get this basic setup working.) I ran the program, created a small map and saved it, and here's the output in the resulting XML file:
<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
<Asset Type="LevelEditorPrototype.Level">
<TileGrid>
<Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>0</X>
<Y>0</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileBlock">
<X>0</X>
<Y>32</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FF0000FF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileVoid">
<X>0</X>
<Y>64</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFF0000</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>0</X>
<Y>96</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
</Item>
<Item>
<Item Type="LevelEditorPrototype.TileVoid">
<X>32</X>
<Y>0</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFF0000</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>32</X>
<Y>32</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileBlock">
<X>32</X>
<Y>64</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FF0000FF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileVoid">
<X>32</X>
<Y>96</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFF0000</Tint>
</Item>
</Item>
<Item>
<Item Type="LevelEditorPrototype.TileBlock">
<X>64</X>
<Y>0</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FF0000FF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileVoid">
<X>64</X>
<Y>32</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFF0000</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>64</X>
<Y>64</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileBlock">
<X>64</X>
<Y>96</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FF0000FF</Tint>
</Item>
</Item>
<Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>96</X>
<Y>0</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileBlock">
<X>96</X>
<Y>32</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FF0000FF</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileVoid">
<X>96</X>
<Y>64</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFF0000</Tint>
</Item>
<Item Type="LevelEditorPrototype.TileFloor">
<X>96</X>
<Y>96</Y>
<Width>32</Width>
<Height>32</Height>
<Origin>0 0</Origin>
<Depth>0</Depth>
<Tint>FFFFFFFF</Tint>
</Item>
</Item>
</TileGrid>
</Asset>
</XnaContent>
So at the very least we do have data information on the tiles generated in the level, so that's something. We'd like our users to be able to load up saved levels during runtime as well, so we mapped the 'L' key to load that saved XML file, and that's where the problem shows up. Our read looks like this:
public static void LoadLevel()
{
using (FileStream stream = new FileStream("example.xml", FileMode.Open))
{
using (XmlReader reader = XmlReader.Create(stream))
{
currentLevel = IntermediateSerializer.Deserialize<Level>(reader, null);
}
}
}
When we try testing that functionality, we get this error:
System.MethodAccessException was unhandled
HResult=-2146233072
Message=Attempt by method 'DynamicClass.ReflectionEmitUtils(System.Object, System.Object)' to access method 'DynamicClass.ReflectionEmitUtils(System.Object, System.Object)' failed.
I have a sneaking suspicion that the IntermediateSerializer doesn't quite work how we want it to work, but I'm not sure how else to parse and store the data effectively. Is there a different setup I should be using here?
The most effective way to be 100% sure of saving and loading tile-based levels have, in my experience, to use BinaryWriter and BinaryReader.
Our level-structure has been a lot different from yours, though; We have many layers. Each layer uses a tileset and consists of instances of Tile. Tile holds its position (Vector2D) and a TileId (index of the tile in the tileset-texture).
The way we put objects in levels are with tilesets that are replaced by real objects on loading.
Anyways, a suitably generic way to save and load data is by letting your classes have a contructor that can take a BinaryReader as an argument, and a method to write itself to a BinaryWriter.
like this:
public Tile(BinaryReader reader)
{
Position.X = reader.ReadFloat();
Position.Y = reader.ReadFloat();
TileId = reader.ReadInt32();
}
public void WriteToStream(BinaryWriter writer)
{
writer.Write(Position.X);
writer.Write(Position.Y);
writer.Write(TileId);
}
if you only have one class to load, you can then simply:
for loading:
var tiles = new List<Tile>();
var reader = new BinaryReader(File.Open("level.bin"));
while (reader.BaseStream.Position < reader.BaseStream.Length)
{
var tile = new Tile(reader);
tiles.Add(tile);
}
reader.Close();
For saving:
var tiles; //lets pretend this is the level
var writer = new BinaryWriter(File.Create("level.bin"));
foreach (var tile in tiles)
{
tile.WriteToStream(writer);
}
writer.Flush(); //IMPORTANT!!!
writer.Close();
If, however, your list contains items of different types, you need to store the type also.
A pretty generic way to do this is by inserting:
writer.Write(tile.GetType().FullName);
before tile.WriteToStream(writer);
and then on loading you need to:
var tileType = Type.GetType(reader.ReadString()); //Read the type from the stream
var constructor = tileType.GetConstructor(new [] { typeof(BinaryReader)}); //get a constructor that can use a binaryreader
var tile = constructor.Invoke(new [] { reader }); //use said constructor to create an instance
Hope this helps. And note that I am writing this out of memory, so syntax errors are probable....

Xpath add a field from an item to another item with a reference id

This is the structure of the file I need to import.
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>2</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
In the page item the tag contains the id of the image item.
How do I add the image url from the image item to the page item?
I'm trying to use
/channel/item[id=ref/ref_value[../entity/text() = 'image_ref']]/image_url but it does not work...
What's the XPath expression to not import the image item but just the page item?
Thanks in advance
Use:
/*/item[type='image' and id=../item[type='page']
/ref[entity = 'image_ref']/ref_value]
/image_url/text()
XSLT - based verification:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:copy-of select=
"/*/item[type='image' and id=../item[type='page']
/ref[entity = 'image_ref']/ref_value]
/image_url/text()"/>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied to the provided XML document:
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>2</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
the XPath expression is evaluated and the result of this evaluation is copied to the output:
url_to_image
Update:
The OP has implied in comments that there may be many "page items" and "image items" and that he needs an expression, getting the image url for only a specific page.
This XPath expression:
/*/item[type='image'
and id=../item[type='page'][1]
/ref[entity = 'image_ref']/ref_value
]
/image_url/text()"/>
produces the wanted image url for the first "page item" in the following XML document:
<channel>
<item>
<type>image</type>
<title>title image</title>
<id>1</id>
<image_url>url_to_image</image_url>
</item>
<item>
<type>image</type>
<title>title image</title>
<id>2</id>
<image_url>url2_to_image</image_url>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>3</id>
<ref>
<entity>image_ref</entity>
<ref_value>1</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
<item>
<type>page</type>
<title>node title</title>
<id>4</id>
<ref>
<entity>image_ref</entity>
<ref_value>2</ref_value>
</ref>
<ref>
<entity>category</entity>
<ref_value>5</ref_value>
</ref>
</item>
</channel>
The result produced is:
url_to_image
To get the wanted url for the second page item, we simply modify the above XPath expression to:
/*/item[type='image'
and id=../item[type='page'][2]
/ref[entity = 'image_ref']/ref_value
]
/image_url/text()"/>
and now the result is:
url2_to_image

SOAP Magento Error on Customer.Create

I am trying to create a customer from the Magja project and the AxisFault i am getting is a 100 "Customer email is required." . I am passing over the correct minimum required params from the 1.7 documentation. Long story my fault code is saying i am not including my email BUT it is clearly there (not putting the sensitive info on SO...so you just have to trust me :) ). Any Ideas?
Stack
org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.
//soapclient line 208
result = sender.sendReceive(method) -> method variable
<mag:call xmlns:mag="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-XML="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sessionId>9be685563680f52c1ab5375bec545dfe</sessionId>
<resourcePath>customer.create</resourcePath>
<args SOAP-ENC:arrayType="xsd:ur-type[1]" xsi:type="SOAP-ENC:Array">
<item SOAP-ENC:arrayType="xsd:ur-type[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="SOAP-XML:Map">
<item>
<key xsi:type="xsd:string">email</key>
<value xsi:type="xsd:string">MY EMAIL</value>
</item>
<item>
<key xsi:type="xsd:string">password_hash</key>
<value xsi:type="xsd:string">4cb9c8a8048fd02294477fcb1a41191a</value>
</item>
<item>
<key xsi:type="xsd:string">group_id</key>
<value xsi:type="xsd:int">1</value>
</item>
<item>
<key xsi:type="xsd:string">store_id</key>
<value xsi:type="xsd:int">1</value>
</item>
<item>
<key xsi:type="xsd:string">lastname</key>
<value xsi:type="xsd:string">LName</value>
</item>
<item>
<key xsi:type="xsd:string">firstname</key>
<value xsi:type="xsd:string">Fname</value>
</item>
<item>
<key xsi:type="xsd:string">website_id</key>
<value xsi:type="xsd:int">1</value>
</item>
</item>
</item>
</args>
</mag:call>
//magentosoapclient line 215
throw axisFault (axisfault -> message)
<?xml version='1.0' encoding='utf-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>100</faultcode>
<faultstring>Customer email is required</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
You'll need to trace/log the data on the Magento end of things. Somehow email's getting lost and/or munged in the process. The PHP code that's called for a customer creation is at
#File: app/code/core/Mage/Customer/Model/Customer/Api.php
public function create($customerData)
{
$customerData = $this->_prepareData($customerData);
try {
$customer = Mage::getModel('customer/customer')
->setData($customerData)
->save();
} catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
return $customer->getId();
}
and the specific exception being sent back to your SOAP client is at
#File: app/code/core/Mage/Customer/Model/Resource/Customer.php
protected function _beforeSave(Varien_Object $customer)
{
parent::_beforeSave($customer);
if (!$customer->getEmail()) {
throw Mage::exception('Mage_Customer', Mage::helper('customer')->__('Customer email is required'));
}
There's something about your client call and/or the specific Magento system you're using that makes Magento think there's no customer email set. A few calls to Mage::Log should set you on the right path.

How to parse SOAP XML in ruby?

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://extranet.mcs.be/DEV_QUALITY_API/modules/quality/services/soap/quality.php"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 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:getQuestionnairesListResponse>
<return SOAP-ENC:arrayType="ns1:QuestionnaireListItem[34]"
xsi:type="ns1:ArrayOfQuestionnaireListItem">
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000022</ID>
<Code xsi:type="xsd:string">Interest PubTransp</Code>
<Reference xsi:type="xsd:string">Check Employees Interest in Public
Transport</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000008</ID>
<Code xsi:type="xsd:string">CS SRE North 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE North 2003</Reference>
</item>
<item xsi:type="ns1:QuestionnaireListItem">
<ID xsi:type="xsd:string">0000000006</ID>
<Code xsi:type="xsd:string">CS SRE South 2003</Code>
<Reference xsi:type="xsd:string">Customer Satisfaction SRE South 2003</Reference>
</item>
.
.
.
I want to parse the above soap String (I actually want to get items from the above soap). How could I do this?
There's a gem called Savon that's specifically made for dealing with SOAP in Ruby.
There's good documentation on the web site, once you looked into that and have more specific questions I'm sure we can help you.

Resources