> For the complete documentation index, see [llms.txt](https://shoppa.gitbook.io/knowledge-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shoppa.gitbook.io/knowledge-hub/api-documentation/endpoints/soap.md).

# SOAP (legacy)

## Legacy

While our SOAP based webservice will remain in operation for some time longer, it is no longer being maintained and will not be updated with bug fixes, etc. If you are already using the SOAP based service we recommend that you switch over to using our REST based service at your earliest convenience. If you are integrating your system to ours for the first time, we strongly urge you to use the REST based service, not the SOAP based one.

The SOAP specific documentation will remain online as long as we accept SOAP requests, only as a convenience to our customers currently using it. Again, if you are building a new integration, use [REST](/knowledge-hub/api-documentation/endpoints/xml.md) instead.

## SOAP

Soap is a standard protocol that will not be discussed in detail here. There are some peculiarities to know about when integrating with Mediablob though; specifically Mediablobs use of an `<AuthHeader />` section.

Another quirk, that is handled automatically by tools such as Visual Studio, is that xml content must be xml-encoded.

## The AuthHeader

Mediablob does not use any cookies or other common login mechanisms to validate access. Instead Mediablob expects an AuthHeader section in the soap header.

The AuthHeader looks like this:

```markup
<AuthHeader xmlns="http://www.mediablob.com/">
  <username>demouser1</username>
  <password>Not_a_real_password</password>
  <customerId>14</customerId>
  <customerIdType>ShoppaID</customerIdType>
</AuthHeader>
```

The `username` and `password` authenticates the user. Mediablob then verifies the users privileges and authorizes the rest of the request.

The `customerId` is used to instruct Mediablob which customer node the uploaded xml file relates to. The `customerId` can either be a `ShoppaID` assigned by Shoppa when the customer node was created, or an `ExternalID` assigned to each store by the customer.

*Contact Shoppa Service Center to change what* `ExternalID` *to use for different stores.*

The `customerId` must always be for or below the node the user logs in to. To prevent pre-generated xml-files to be uploaded to the wrong account by mistake, the `customerId` must correspond with the `customerId` of the uploaded xml file.

## Encoding

The content of any xml element must be xml encoded. This is achieved by replacing each character with its encoded counterpart. Thus, in the Mediablob product xml you would need to encode the product text `Köp & vinn!` as `Köp &amp; vinn!`.

*Xml encoding is automatically handled by high-level frameworks like C# and Java. You only need think about this when you create your xml file manually.*

What can be a bit confusing is when you wrap the Mediablob xml in soap. Since your xml file is content in a soap element, it needs to be xml encoded, including any text you encoded inside your xml. The product text above would then become `Köp &amp;amp; vinn!`.

Mediablob also requires an xml declaration line at the top.

## Example SOAP Request

Lets say we want to upload the following product definition:

```markup
<mediablob customerID="1143" customerIDType="ShoppaID" createDate="2018-05-12T00:00:00" schemaVersion="1.7">
  <products>
    <product id="65467-14" idType="Code1">
      <codes>
        <code name="EAN13" value="123456789012" />
      </codes>
      <texts>
        <text productName="Champagneglas" brand="Orrefors" languageCode="sv-SE" />
      </texts>
    </product>
  </products>
</mediablob>
```

Using the following user details:

* **username**: demouser1
* **password**: Not\_a\_real\_password
* **ShoppaID**: 1143

Encoded and wrapped in a valid soap request this becomes:

```markup
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <AuthHeader xmlns="http://www.mediablob.com/">
      <username>demouser1</username>
      <password>Not_a_real_password</password>
      <customerId>1132</customerId>
      <customerIdType>ShoppaID</customerIdType>
    </AuthHeader>
    <CultureHeader xmlns="http://www.mediablob.com/">
      <currentCulture>sv-SE</currentCulture>
    </CultureHeader>
  </soap:Header>
  <soap:Body>
    <UploadProductXml xmlns="http://www.mediablob.com/">
      <productXml>&lt;mediablob customerID=&quot;1143&quot; customerIDType=&quot;ShoppaID&quot; createDate=&quot;2018-05-12T00:00:00&quot; schemaVersion=&quot;1.7&quot;&gt;
  &lt;products&gt;
    &lt;product id=&quot;65467-14&quot; idType=&quot;Code1&quot;&gt;
      &lt;codes&gt;
        &lt;code name=&quot;EAN13&quot; value=&quot;123456789012&quot; /&gt;
      &lt;/codes&gt;
      &lt;texts&gt;
        &lt;text productName=&quot;Champagneglas&quot; brand=&quot;Orrefors&quot; languageCode=&quot;sv-SE&quot; /&gt;
      &lt;/texts&gt;
    &lt;/product&gt;
  &lt;/products&gt;
&lt;/mediablob&gt;</productXml>
    </UploadProductXml>
  </soap:Body>
</soap:Envelope>
```

Copy this text and POST it with Wizdler to Mediablobs development endpoint. You should get the following response with status code 200 if you did it right:

```markup
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <UploadProductXmlResponse xmlns="http://www.mediablob.com/">
            <UploadProductXmlResult />
        </UploadProductXmlResponse>
    </soap:Body>
</soap:Envelope>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://shoppa.gitbook.io/knowledge-hub/api-documentation/endpoints/soap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
