Question

As per SOAP API need we want's to delimit street into street 1 and street 2 fields for result.

I have override info method of Mage_Sales_Model_Order_Api Class

    public function info($orderIncrementId)
    {

        $result = parent::info($orderIncrementId);
        $order = $this->_initOrder($orderIncrementId);

        $streetLines = $order->getBillingAddress()->getStreet();
       // unset($result['billing_address']['street']);
        foreach ($streetLines as $i=>$line) {
            $result['billing_address']['address_street'.($i+1)] = $line; 
        }  

        $streetLines1 = $order->getShippingAddress()->getStreet();
       // unset($result['shipping_address']['street']);
        foreach ($streetLines1 as $i=>$line) {
            $result['shipping_address']['address_street'.($i+1)] = $line; 
        }

        return $result;
    }

And also added below code in wsdl.xml of custom module in local

<?xml version="1.0" encoding="UTF-8"?>
<definitions>
    <types>
        <schema> 
              <complexType name="salesOrderAddressEntity">
                <all> 
                     <element name="address_street1" type="xsd:string" minOccurs="0" />
                     <element name="address_street2" type="xsd:string" minOccurs="0" />
                </all>
            </complexType>
            </schema>
        </types>
</definitions>

Also below code in wsi.xml in custom module

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             name="{{var wsdl.name}}"
             targetNamespace="urn:{{var wsdl.name}}">
        <wsdl:types>
            <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
                  <xsd:complexType name="salesOrderAddressEntity">
                    <xsd:sequence> 
                          <xsd:element name="address_street1" type="xsd:string" minOccurs="0" />
                      <xsd:element name="address_street2" type="xsd:string" minOccurs="0" />
                    </xsd:sequence>
                </xsd:complexType>
                </xsd:schema>
        </wsdl:types>
 </wsdl:definitions>

Below code in api2.xml:

<?xml version="1.0"?>
<config>
    <api2>  
      <resources>
            <order translate="title" module="api2">
                <attributes   module="api2">
                  <order_type>Order Type</order_type>
                </attributes>
            </order>
             <order_address translate="title" module="api2">
                <attributes translate=" address_street1 address_street2 "   module="api2"> 
                     <address_street1>Street1</address_street1>
                 <address_street2>Street2</address_street2> 
                </attributes> 
             </order_address>
        </resources>
   </api2>
</config>

Is anything else i need to modify to show street as street1 & street2 in result of API method salesOrderInfo?

If I print $result in info(), it is showing street1 & street2 field values in shipping_address and billing_address array, but when I print SOAP API response then it is not displaying it's value.

Was it helpful?

Solution

As per above description suddenly it is working fine. Now it is showing address_street1 & address_street2 in SalesOrderInfo Soap Api method response.

I think it was Caching issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top