0

I am able to create a customer using customerCustomerCreate api. But I am not able to create customer address using "customerAddressCreate" api. I am using the below code,

SoapSerializationEnvelope env = new SoapSerializationEnvelope(
                            SoapEnvelope.VER11);

                env.dotNet = false;
                env.xsd = SoapSerializationEnvelope.XSD;
                env.enc = SoapSerializationEnvelope.ENC;

                SoapObject request = new SoapObject(NAMESPACE, "login");

                request.addProperty("username", "user");
                request.addProperty("apiKey", "apikey");

                env.setOutputSoapObject(request);

                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

                androidHttpTransport.call("", env);
                Object result = env.getResponse();

                Log.e("sessionId", result.toString());




                String sessionId = result.toString();


   request = new SoapObject(NAMESPACE, "customerAddressCreate");
            request.addProperty("sessionId", sessionId);

            request.addProperty("customerId",custId);

            SoapObject customerEntity = new SoapObject(NAMESPACE, "customerAddressEntityCreate");

            customerEntity.addProperty("city", "bangalore");
            customerEntity.addProperty("company", "outthinking");
            customerEntity.addProperty("country_id", "01");
            customerEntity.addProperty("fax", "08012345");
            customerEntity.addProperty("firstname", "amit");
            customerEntity.addProperty("lastname", "chandra");
            customerEntity.addProperty("middlename", "raj");
            customerEntity.addProperty("postcode", "560007");
            customerEntity.addProperty("prefix", "a");
            customerEntity.addProperty("region_id", 03);
            customerEntity.addProperty("region", "karnataka");
            customerEntity.addProperty("street","Banglore");
            customerEntity.addProperty("suffix", "ac");
            customerEntity.addProperty("telephone", "+91-9962025341");
            customerEntity.addProperty("is_default_billing", false);
            customerEntity.addProperty("is_default_shipping", false);

            request.addProperty("addressdata", customerEntity);

It is throwing error

SoapFault - faultcode: '100' faultstring: 'Please enter the first name.
    Please enter the last name.
    Please enter the street.
    Please enter the city.
    Please enter the telephone number.
    Please enter the zip/postal code.
    Please enter the country.' faultactor: 'null' detail: null

Please let me know what wrong I am doing in this code.

5
  • Check out this similar problem here: magento.stackexchange.com/a/52313/231 I think the last line of your code should be request.addProperty("customerData", customerEntity); and not request.addProperty("addressdata", customerEntity); Commented Jun 30, 2015 at 7:13
  • Anna Volks thanks for your reply. I tried what you have mentioned in the reply, but still I am getting same error :(. Commented Jun 30, 2015 at 7:32
  • Sorry, my fault. Was looking at the wrong soap call. addressdata should be right for creating the address. Have a look if your request matches with the definition of the SOAP API: magentocommerce.com/api/soap/customer/customerAddress/… Commented Jun 30, 2015 at 7:41
  • Sorry Anna I followed same link which one you sent, but I am not able to create address using that api. Will you please try that api and let me know what changes we need to do please. I need this one very desperately. Commented Jun 30, 2015 at 9:22
  • Sorry, but I'm not into Android programming. You might try to search for other ksoap api examples here on this platform. Commented Jun 30, 2015 at 9:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.