6 Replies Latest reply on Jan 27, 2015 5:10 AM by GS1234

    BC Ecommerce SOAP Error: Server did not recognize the value of HTTP Header SOAPAction

    GS1234 Level 1

      I am trying to add a product to an ecommerce site with this soap action: Product_UpdateInsert

       

      I have followed this very brief instruction: https://jollyrogers.worldsecuresystems.com/catalystwebservice/catalystecommercewebservice. asmx?op=Product_UpdateInsert

       

      I have a html page in a secure area with a jQuery ajax soap script.

       

      I get the this error when I run the script:

       

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server did not recognize the value of HTTP Header SOAPAction: https://jollyrogers.worldsecuresystems.com/CatalystDeveloperService/CatalystEcommerceWebse rvice/Product_UpdateInsert.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

       

      I have also tried to add a header with the Soap action with the beforeSend in the ajax call.

       

      This must have been solved before I suppose?

       

       

      Here is my script:

       

      <!DOCTYPE html>

      <html lang="en">

      <head>

      <title>Test SOAP Request</title>

          <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>

          <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.3.1/jquery.cookie.min.js"></script>

          <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.1/underscore-min.js"></script>

          <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>

          <script type="text/javascript" src="//cdn.worldsecuresystems.com/bcapi/bcapi-0.0.1.min.js"></script>

      </head>

      <body>

       

      <script>

       

      var wsUrl = "https://jollyrogers.worldsecuresystems.com/catalystwebservice/catalystecommercewebservice. asmx";

       

      var soapRequest =

      '<?xml version="1.0" encoding="utf-8"?> \

      <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> \

        <soap12:Body> \

          <Product_UpdateInsert xmlns="https://jollyrogers.worldsecuresystems.com/CatalystDeveloperService/CatalystEcommerceWebse rvice"> \

            <username>myEmailAdress</username> \

            <password>mySecretPassw</password> \

            <siteId>1894001</siteId> \

            <productList> \

              <Products> \

                <productCode>ZJAWEyuuyN</productCode> \

                <productName>My test product</productName> \

                <description>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</description> \

                <smallImage>/images/product1/small.jpg</smallImage> \

                <largeImage>/images/product1/large.jpg</largeImage> \

               <cataloguesArray> \

                   <string>/Store/</string> \

                </cataloguesArray> \

                <pricesSaleArray> \

                  <string>US/19.95,3/17.96,7/16.96</string> \

                </pricesSaleArray> \

                <pricesRetailArray> \

                  <string>US/20,5/19,8/20</string> \

                </pricesRetailArray> \

                <pricesWholesaleArray> \

                  <string>US/20,5/19,8/20</string> \

                </pricesWholesaleArray> \

                <wholesaleTaxCodeArray> \

                  <string>US/0.00</string> \

                </wholesaleTaxCodeArray> \

                <taxCodeArray> \

                  <string>GB/VAT</string> \

                </taxCodeArray> \

                <groupProducts> \

                  <string>580H0036BL</string> \

                  <string>ACAI60</string> \

                  <string>ABC-123</string> \

                </groupProducts> \

                <groupProductsDescriptions> \

                  <string>Lorem ipsum dolor sit amet</string> \

                  <string>consectetur adipisicing elit</string> \

                </groupProductsDescriptions> \

                <supplierEntityId>1234</supplierEntityId> \

                <supplierCommission>0</supplierCommission> \

                <weight>30</weight> \

                <tags>NEW!</tags> \

                <unitType>string</unitType> \

                <minUnits>0</minUnits> \

                <maxUnits>2</maxUnits> \

                <inStock>43</inStock> \

                <onOrder>3</onOrder> \

                <reOrder>2</reOrder> \

                <inventoryControl>true</inventoryControl> \

                <canPreOrder>true</canPreOrder> \

                <custom1>Text in custom field 1</custom1> \

                <custom2>Text in custom field 2</custom2> \

                <custom3>Text in custom field 3</custom3> \

                <custom4>Text in custom field 4</custom4> \

                <popletImages>/images/image1.jpg;/images/image2.jpg;</popletImages> \

                <enabled>true</enabled> \

                <deleted>false</deleted> \

                <captureDetails>true</captureDetails> \

                <downloadLimitCount>20</downloadLimitCount> \

                <limitDownloadsToIP>0</limitDownloadsToIP> \

                <isOnSale>true</isOnSale> \

                <hideIfNoStock>true</hideIfNoStock> \

                <productAttributes>Size*|5|Y:L||UK/2|US/20,S||UK/1|US/10</productAttributes> \

                <isGiftVoucher>false</isGiftVoucher> \

                <enableDropShipping>true</enableDropShipping> \

                <productWeight>0</productWeight> \

                <productWidth>0</productWidth> \

                <productHeight>0</productHeight> \

                <productDepth>0</productDepth> \

                <excludeFromSearch>false</excludeFromSearch> \

                <productTitle>My product title</productTitle> \

                <cycletypeId>3</cycletypeId> \

                <cycletypeCount>-1</cycletypeCount> \

                <slug>my-product</slug> \

                <hasVariations>true</hasVariations> \

                <variations> \

                  <ProductVariation xsi:nil="true" /> \

                  <ProductVariation xsi:nil="true" /> \

                </variations> \

              </Products> \

            </productList> \

          </Product_UpdateInsert> \

        </soap12:Body> \

      </soap12:Envelope>';

       

      $.ajax({

           type: "POST",

           beforeSend: function(xhr){xhr.setRequestHeader('SOAPAction', 'https://jollyrogers.worldsecuresystems.com/CatalystDeveloperService/CatalystEcommerceWebse rvice/Product_UpdateInsert');},

           url: wsUrl,

           contentType: "text/xml",

           dataType: "xml",

           data: soapRequest,

           success: processSuccess,

           error: processError

      });

       

      function processSuccess(data, status, req)

      {

         if (status == "success")

         alert("Success!");

      }

       

      function processError(data, status, req)

      {

         alert("Failed!");

         alert(req.responseText + " " + status);

      }

      </script>

       

      </body>

      </html>