Paul Allsopp in php , Magento, PHP Developers, Programmers Software Developer • Performance Food Group May 25, 2016 · 1 min read · +200

Magento SOAP API Error…more soap, cleaner results.


So I was beating my head against a wall today because I was writing an import script, which will pull sales order history data from an existing cart system, and put it into Magento. Everything was working fine until I got to the operation: shoppingCartPaymentList. The problem was that there was a SOAP error that kept eluding to the fact that there was something ‘missing’ in the setup. I even found many posts that said this, although none of them could pinpoint what it was. When someone says “Yeah, something isn’t configured properly”, but has no answer to what it might be, it’s better to ignore them.

So after digging around for some time, I finally found the issue, and the solution!

The error message was along the lines of “object hasn’t ‘code’ property”, and was actually caused by a bad WSDL file in the Magento core library.

The file: app/code/core/Mage/Checkout/etc/wsdl.xml
The block in question:

< complexType name = "shoppingCartPaymentMethodResponseEntityArray" >
    < all >
        < element name = "code" type = "xsd:string" />
        < element name = "title" type = "xsd:string" />
        < element name = "cc_types" type = "typens:associativeArray" />
</all >
</complexType >

What I had to do is change that block out for this:


< complexType name = "shoppingCartPaymentMethodResponseEntity" >
    < all >
        < element name = "code" type = "xsd:string" />
        < element name = "title" type = "xsd:string" />
        < element name = "cc_types" type = "typens:associativeArray" minOccurs = "0" />
    </all >
</complexType >
< complexType name = "shoppingCartPaymentMethodResponseEntityArray" >
    < complexContent >
        < restriction base = "soapenc:Array" >
            < attribute ref = "soapenc:arrayType" wsdl:arrayType = "typens:shoppingCartPaymentMethodResponseEntity[]" />
        </restriction >
    </complexContent >
</complexType >




After that all was well again and I was able to recoup some of my lost sanity. 
Maybe this will help someone else.

P.