Dustin Stanley
asked on
MS Access MSXML2 DomDocument.Load and XMLHTTP.Send Not Sending utf-8 Char Format Correctly
I am trying to send a API call to a ebay Server API call is "AddFixedPriceItem"
My file is in XML properly formated in UTF-8. But everytime I make the call it returns this error message.
Invalid request encoding. Please use utf-8 encoding and eliminate any non utf-8 encoding in request content.
<ErrorCode>20400</ErrorCod e>
Someone online said they had the same problem and removed the Quotes from the XML Declaration. This did not help me.
I truly believe there is something altered when Access runs my MSXML2 Code.
Here is my XML File:
How can I make Access pass my XML document over HTTP POST without altering it.
I can perfectly make this call from the EBay API Call Test Tool they have and also with Fiddler.
THANK YOU!
My file is in XML properly formated in UTF-8. But everytime I make the call it returns this error message.
Invalid request encoding. Please use utf-8 encoding and eliminate any non utf-8 encoding in request content.
<ErrorCode>20400</ErrorCod
Someone online said they had the same problem and removed the Quotes from the XML Declaration. This did not help me.
I truly believe there is something altered when Access runs my MSXML2 Code.
Public Sub EbaySenderXmlAddFixedPriceItem()
Dim reader As New MSXML2.XMLHTTP40
Dim doc As New MSXML2.DOMDocument
doc.Load ("C:\Users\Shipper Station\Desktop\Test14.xml")
reader.Open "POST", "https://api.sandbox.ebay.com/ws/api.dll", False
reader.setRequestHeader "X-EBAY-API-CALL-NAME", "AddFixedPriceItem"
reader.setRequestHeader "X-EBAY-API-DETAIL-LEVEL", "0"
reader.setRequestHeader "X-EBAY-API-COMPATIBILITY-LEVEL", "967"
reader.setRequestHeader "X-EBAY-API-SITEID", "0"
' reader.setRequestHeader "X-EBAY-API-DEV-NAME", ""
'reader.setRequestHeader "X-EBAY-API-APP-NAME", ""
'reader.setRequestHeader "X-EBAY-API-CERT-NAME", ""
reader.setRequestHeader "CONTENT-TYPE", "text/xml"
'reader.setRequestHeader "X-EBAY-API-IAF-TOKEN", "TOKEN CODE GOES HERE"
reader.send doc.XML
Do Until reader.ReadyState = 4
DoEvents
Loop
MsgBox (reader.responseText)
If reader.Status = 200 Then
Set doc = reader.responseXML
doc.Save "C:\Users\Shipper Station\Documents\Access XML Save Files\eBayReturnFile.xml"
'MsgBox "PERFECT"
Application.ImportXML "C:\Users\Shipper Station\Documents\Access XML Save Files\eBayReturnFile.xml", acStructureAndData
Else
MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
VBE.ActiveCodePane.CodeModule, vbOKOnly, "Error"
End If
Set reader = Nothing
End Sub
Here is my XML File:
<?xml version="1.0" encoding="utf-8"?>
<AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>TOKEN CODE GOES HERE</RequesterCredentials>
<ErrorLanguage>en_US</ErrorLanguage>
<Version>967</Version>
<WarningLevel>Low</WarningLevel>
<Item>
<CategoryMappingAllowed>true</CategoryMappingAllowed>
<Country>US</Country>
<Currency>USD</Currency>
<Description>TEST ITEM DESCRIPTION DO NOT BUY</Description>
<ListingDuration>Days_7</ListingDuration>
<ListingType>FixedPriceItem</ListingType>
<PaymentMethods>PayPal</PaymentMethods>
<PayPalEmailAddress>XXXXXXX</PayPalEmailAddress>
<PrimaryCategory>
<CategoryID>14111</CategoryID>
</PrimaryCategory>
<ProductListingDetails>
<UPC>Does not apply</UPC>
<BrandMPN>
<Brand>GE</Brand>
<MPN>MROGE1245GETEST11</MPN>
</BrandMPN>
</ProductListingDetails>
<Quantity>6</Quantity>
<ShippingDetails>
<ShippingServiceOptions>
<ShippingService>UPSGround</ShippingService>
<ShippingServicePriority>1</ShippingServicePriority>
<FreeShipping>true</FreeShipping>
</ShippingServiceOptions>
<ShippingType>Flat</ShippingType>
</ShippingDetails>
<Site>US</Site>
<StartPrice>500</StartPrice>
<Title>TEST ITEM2</Title>
<SKU>MROSKUTEST2</SKU>
<PostalCode>46016</PostalCode>
<PictureDetails>
<PictureURL>https:Z4AG1XG2XKQ%20(1).jpg</PictureURL>
</PictureDetails>
<DispatchTimeMax>3</DispatchTimeMax>
<ReturnPolicy>
<RefundOption>MoneyBack</RefundOption>
<ReturnsWithinOption>Days_30</ReturnsWithinOption>
<ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
<Description>If you arenot satisfied, return the item for refund.</Description>
<ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>
</ReturnPolicy>
<InventoryTrackingMethod>SKU</InventoryTrackingMethod>
<ConditionID>3000</ConditionID>
</Item>
</AddFixedPriceItemRequest>
How can I make Access pass my XML document over HTTP POST without altering it.
I can perfectly make this call from the EBay API Call Test Tool they have and also with Fiddler.
THANK YOU!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THANK YOU AND GOD BLESS!
ASKER
SERIOUSLY THANK YOU SO MUCH!
Open in new window