Here's one example with 2 order details (products ordered). Remember shipping calculation occurs after user has placed items on checkout so we're using the order detail terminology. I hope the example below helps. One thing to note, the product variant's Extension data (under the ProductVariantExtension node below) is made available to your shipping calculation so you can get creative and pick that value to expand on your calculation. (e.g. a product may have additional surcharge because it's a dangerous for shipping item and you may need to purchase insurance)
<in>
<user>
<userHostAddress>127.0.0.1</userHostAddress>
<username>host</username>
<roles>
<role>Role1</role>
<role>Role2</role>
</roles>
<email>user@address.com</email>
</user>
<salesOrder>
<orderDate>2001-01-01 12:00:00</orderDate>
<subTotalAmount>34.000</subTotalAmount>
<shippingCountryCode>US</shippingCountryCode>
<shippingSubdivisionCode>US-CA</shippingSubdivisionCode>
<shippingPostalCode>90210</shippingPostalCode>
<salesOrderDetails>
<salesOrderDetail>
<price>10.000</price>
<quantity>1</quantity>
<discountAmount>0</discountAmount>
<weight>10</weight>
<depth>10</depth>
<width>20</width>
<height>30</height>
<requireShipping>true</requireShipping>
<productVariantExtension>
<data>
<shippingRate>1.00</shippingRate>
</data>
</productVariantExtension>
</salesOrderDetail>
<salesOrderDetail>
<price>12.000</price>
<quantity>2</quantity>
<discountAmount>0</discountAmount>
<weight>20</weight>
<depth>15</depth>
<width>25</width>
<height>10</height>
<requireShipping>true</requireShipping>
<productVariantExtension />
</salesOrderDetail>
</salesOrderDetails>
</salesOrder>
</in>