User409317770 posted
I am getting the following error message "The remote server returned an error: (405) Method Not Allowed." when I send the below request below to Fedex. Does anyone one know what I am doing wrong? Thanks.
Dim xmlRequest = <ns:TrackRequest xmlns:ns="http://fedex.com/ws/track/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://fedex.com/ws/track/v3 TrackService_v2.xsd ">
<ns:WebAuthenticationDetail>
<ns:UserCredential>
<ns:Key><%= key %></ns:Key>
<ns:Password><%= password %></ns:Password>
</ns:UserCredential>
</ns:WebAuthenticationDetail>
<ns:ClientDetail>
<ns:AccountNumber><%= accountNumber %></ns:AccountNumber>
<ns:MeterNumber><%= meterNumber %></ns:MeterNumber>
</ns:ClientDetail>
<ns:TransactionDetail>
<ns:CustomerTransactionId>User Customizable Field</ns:CustomerTransactionId>
</ns:TransactionDetail>
<ns:Version>
<ns:ServiceId>trck</ns:ServiceId>
<ns:Major>3</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
<ns:PackageIdentifier>
<ns:Value><%= trackingNumber %></ns:Value>
<ns:Type>TRACKING_NUMBER_OR_DOORTAG</ns:Type>
</ns:PackageIdentifier>
<ns:IncludeDetailedScans>true</ns:IncludeDetailedScans>
</ns:TrackRequest>
Dim uri As New UriBuilder()
With uri
.Host = "gatewaybeta.fedex.com"
.Port = 443
.Scheme = "https"
End With
Dim request As New XmlSend(uri.ToString())
Dim xml As String = xmlRequest.ToString()
With request.Request
.Referer = "My Company"
.Accept = "image/gif, image/jpeg, image/pjpeg, text/plain, text/html, */*"
.ContentType = "image/gif"
.ContentLength = xml.Length
.Timeout = ConstantsCommon.XML_QUERY_TIMEOUT
.KeepAlive = True
End With
Try
Dim xmlResponse As XDocument = request.SendToXml(xml)
Catch ex As Exception
compDB.Dispose()
Me._xmlFail = True
End Try