Upperdecker
asked on
FedEx Create Shipment api for classic asp
Can anyone help me with coding the FedEx api "Create Shipment" in classic asp? I have my Dev account ready but asp is old and not supported by Fedex api.
Thanks
Thanks
according to their site, they no longer offer classic asp support, which you've found out. you're better off using .NET to communicate with FedEx. If that's not an option, can you provide a link (public) to their .NET api and maybe we can help translate it over to classic asp. i looked around but it looks like an account is required.
if you're able to use PHP, I found this existing class to use with FedEx:
http://sourceforge.net/projects/fedexdc/files/fedexdc/
http://sourceforge.net/projects/fedexdc/files/fedexdc/
As long as they are using SOAP, REST etc, you can use whatever language you want. With classic asp, you just have to build the soap envelope, xmlhttppost it, then retrieve the response and parse out what you need. The other languages like .NET or PHP may have libraries for this. With ASP Classic, you have to build manually.
I have a good handful of answers here on EE about this very thing and this is one of them with a portion of the code sample below. The sample here is for sending a SOAP call for credit card processing but the idea is identical.
https://www.experts-exchange.com/questions/28418684/How-to-send-an-HTTPS-POST-to-an-external-URL-and-receive-response-using-Classic-ASP.html
The top portion creates the xml soap to be posted. If you were to response.write the strRequest, you would get the xml.
Where you see, Dim objXMLHTTP is the start of sending the post to the url
strResult is where the results (xml) is held and below that you can see how I am parsing the xml.
If you can post which webservice you are going after and the SOAP/REST documentation we can help you in detail.
I have a good handful of answers here on EE about this very thing and this is one of them with a portion of the code sample below. The sample here is for sending a SOAP call for credit card processing but the idea is identical.
https://www.experts-exchange.com/questions/28418684/How-to-send-an-HTTPS-POST-to-an-external-URL-and-receive-response-using-Classic-ASP.html
The top portion creates the xml soap to be posted. If you were to response.write the strRequest, you would get the xml.
Where you see, Dim objXMLHTTP is the start of sending the post to the url
strResult is where the results (xml) is held and below that you can see how I am parsing the xml.
function searchTransactions(SalesOrderID)
strRequest =""
strRequest =strRequest&"<?xml version=""1.0"" encoding=""UTF-8""?>"
strRequest =strRequest&"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" "
strRequest =strRequest&"xmlns:ns1=""urn:usaepay"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" "
strRequest =strRequest&"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" "
strRequest =strRequest&"xmlns:SOAP-ENC=""http://schemas.xmlsoap.org/soap/encoding/"" "
strRequest =strRequest&"SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">"
strRequest =strRequest&"<SOAP-ENV:Body>"
strRequest =strRequest&"<ns1:searchTransactions> "
strRequest =strRequest&"<Token xsi:type=""ns1:ueSecurityToken"">"
strRequest =strRequest&"<ClientIP xsi:type=""xsd:string"">"& clientip &"</ClientIP>"
strRequest =strRequest&"<PinHash xsi:type=""ns1:ueHash"">"
strRequest =strRequest&"<HashValue xsi:type=""xsd:string"">"& hash &"</HashValue>"
strRequest =strRequest&"<Seed xsi:type=""xsd:string"">"& seed &"</Seed>"
strRequest =strRequest&"<Type xsi:type=""xsd:string"">"& hashtype &"</Type>"
strRequest =strRequest&"</PinHash>"
strRequest =strRequest&"<SourceKey xsi:type=""xsd:string"">"& sourcekey &"</SourceKey>"
strRequest =strRequest&"</Token>"
strRequest =strRequest&"<Search SOAP-ENC:arrayType=""ns1:SearchParam[1]"" xsi:type=""ns1:SearchParamArray""> "
strRequest =strRequest&"<item xsi:type=""ns1:SearchParam""> "
strRequest =strRequest&"<Field xsi:type=""xsd:string"">Invoice</Field> "
strRequest =strRequest&"<Type xsi:type=""xsd:string"">eq</Type> "
strRequest =strRequest&"<Value xsi:type=""xsd:string"">"&SalesOrderID&"</Value> "
strRequest =strRequest&"</item> "
strRequest =strRequest&"</Search> "
strRequest =strRequest&"<MatchAll xsi:type=""xsd:boolean"">true</MatchAll> "
strRequest =strRequest&"<Start xsi:type=""xsd:integer"">0</Start> "
strRequest =strRequest&"<Limit xsi:type=""xsd:integer"">10</Limit>"
strRequest =strRequest&"<Sort xsi:type=""xsd:string"">created</Sort> "
strRequest =strRequest&"</ns1:searchTransactions> "
strRequest =strRequest&"</SOAP-ENV:Body> "
strRequest =strRequest&"</SOAP-ENV:Envelope>"
Dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
strURL = PostToUrl
objXMLHTTP.setTimeouts 10000, 60000 , 60000, 360000
objXMLHTTP.open "POST", "" & strURL & "" , False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.send(strRequest)
strResult = objXMLHTTP.responseText
dim getCustPayMethText
getCustPayMethText=strResult
Set objReturn = CreateObject("MSXML2.DOMDocument.3.0")
objReturn.loadXML objXMLHTTP.responseText
' ********** READ XML OUTPUT *********'
if not objReturn.getElementsByTagName("TransactionsMatched").Item(0) is Nothing then
TransactionsMatched= objReturn.getElementsByTagName("TransactionsMatched").Item(0).text
else
TransactionsMatched="0"
end if
if cdbl(TransactionsMatched)>0 then
for x = 0 to cint(TransactionsMatched)-1
if not objReturn.getElementsByTagName("RefNum").Item(x) is Nothing then
RefNum= objReturn.getElementsByTagName("RefNum").Item(x).text
else
RefNum="N/A"
end if
if not objReturn.getElementsByTagName("Result").Item(x) is Nothing then
Result= objReturn.getElementsByTagName("Result").Item(x).text
else
Result="N/A"
end if
if not objReturn.getElementsByTagName("ResultCode").Item(x) is Nothing then
ResultCode= objReturn.getElementsByTagName("ResultCode").Item(x).text
else
ResultCode="N/A"
end if
if not objReturn.getElementsByTagName("CardNumber").Item(x) is Nothing then
CardNumber= objReturn.getElementsByTagName("CardNumber").Item(x).text
else
CardNumber="NA/A"
end if
if not objReturn.getElementsByTagName("TransactionType").Item(x) is Nothing then
TransactionType= objReturn.getElementsByTagName("TransactionType").Item(x).text
else
TransactionType="0"
end if
if ResultCode = "A" then
searchTransactions="Approved"
else
searchTransactions="Not Approved"
end if
end Function
If you can post which webservice you are going after and the SOAP/REST documentation we can help you in detail.
ASKER
Sorry for the delay . I'm not sure if this is what you need.
I would like to start with Ship Service: Create Shipment
Express Shipment:
I would like to start with Ship Service: Create Shipment
Express Shipment:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v13">
<SOAP-ENV:Body>
<ns1:ProcessShipmentRequest>
<ns1:WebAuthenticationDetail>
<ns1:UserCredential>
<ns1:Key>“Input Your Information”</ns1:Key>
<ns1:Password>“Input Your Information”</ns1:Password>
</ns1:UserCredential>
</ns1:WebAuthenticationDetail>
<ns1:ClientDetail>
<ns1:AccountNumber>“Input Your Information”</ns1:AccountNumber>
<ns1:MeterNumber>“Input Your Information”</ns1:MeterNumber>
</ns1:ClientDetail>
<ns1:TransactionDetail>
<ns1:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns1:CustomerTransactionId>
</ns1:TransactionDetail>
<ns1:Version>
<ns1:ServiceId>ship</ns1:ServiceId>
<ns1:Major>13</ns1:Major>
<ns1:Intermediate>0</ns1:Intermediate>
<ns1:Minor>0</ns1:Minor>
</ns1:Version>
<ns1:RequestedShipment>
<ns1:ShipTimestamp>2013-07-16T05:14:28+00:00</ns1:ShipTimestamp>
<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>
<ns1:ServiceType>PRIORITY_OVERNIGHT</ns1:ServiceType>
<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>
<ns1:TotalWeight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>50</ns1:Value>
</ns1:TotalWeight>
<ns1:Shipper>
<ns1:Contact>
<ns1:PersonName>Sender Name</ns1:PersonName>
<ns1:CompanyName>Sender Company Name</ns1:CompanyName>
<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>
</ns1:Contact>
<ns1:Address>
<ns1:StreetLines>Address Line 1</ns1:StreetLines>
<ns1:City>Austin</ns1:City>
<ns1:StateOrProvinceCode>TX</ns1:StateOrProvinceCode>
<ns1:PostalCode>73301</ns1:PostalCode>
<ns1:CountryCode>US</ns1:CountryCode>
</ns1:Address>
</ns1:Shipper>
<ns1:Recipient>
<ns1:Contact>
<ns1:PersonName>Recipient Name</ns1:PersonName>
<ns1:CompanyName>Recipient Company Name</ns1:CompanyName>
<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>
</ns1:Contact>
<ns1:Address>
<ns1:StreetLines>Address Line 1</ns1:StreetLines>
<ns1:City>Herndon</ns1:City>
<ns1:StateOrProvinceCode>VA</ns1:StateOrProvinceCode>
<ns1:PostalCode>20171</ns1:PostalCode>
<ns1:CountryCode>US</ns1:CountryCode>
<ns1:Residential>true</ns1:Residential>
</ns1:Address>
</ns1:Recipient>
<ns1:ShippingChargesPayment>
<ns1:PaymentType>SENDER</ns1:PaymentType>
<ns1:Payor>
<ns1:ResponsibleParty>
<ns1:AccountNumber>“Input Your Information”</ns1:AccountNumber>
<ns1:Contact/>
<ns1:Address>
<ns1:CountryCode>US</ns1:CountryCode>
</ns1:Address>
</ns1:ResponsibleParty>
</ns1:Payor>
</ns1:ShippingChargesPayment>
<ns1:SpecialServicesRequested>
<ns1:SpecialServiceTypes>COD</ns1:SpecialServiceTypes>
<ns1:CodDetail>
<ns1:CodCollectionAmount>
<ns1:Currency>USD</ns1:Currency>
<ns1:Amount>150</ns1:Amount>
</ns1:CodCollectionAmount>
<ns1:CollectionType>ANY</ns1:CollectionType>
</ns1:CodDetail>
</ns1:SpecialServicesRequested>
<ns1:LabelSpecification>
<ns1:LabelFormatType>COMMON2D</ns1:LabelFormatType>
<ns1:ImageType>PDF</ns1:ImageType>
<ns1:LabelStockType>PAPER_7X4.75</ns1:LabelStockType>
</ns1:LabelSpecification>
<ns1:RateRequestTypes>ACCOUNT</ns1:RateRequestTypes>
<ns1:PackageCount>1</ns1:PackageCount>
<ns1:RequestedPackageLineItems>
<ns1:SequenceNumber>1</ns1:SequenceNumber>
<ns1:GroupPackageCount>1</ns1:GroupPackageCount>
<ns1:Weight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>5</ns1:Value>
</ns1:Weight>
<ns1:Dimensions>
<ns1:Length>20</ns1:Length>
<ns1:Width>20</ns1:Width>
<ns1:Height>10</ns1:Height>
<ns1:Units>IN</ns1:Units>
</ns1:Dimensions>
</ns1:RequestedPackageLineItems>
</ns1:RequestedShipment>
</ns1:ProcessShipmentRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
That looks like what you need. Now start coding to asp/vb.
Where you see, "input your information here" needs to be replaced with variables.
This is the part that takes you up to line 39 of my example. Once you get this far, try adding my example of the xmlhttp request which starts at line 43 to 53. Notice I have a strURL. That is another variable that needs to be defined at the top of the page. This is the url you are going to post to.
After this line, strResult = objXMLHTTP.responseText add one more line to send strResult to the screen for testing
response.write strResult.
See how far you can get from here. Work through your errors the best you can. If you can get output from strResult, we can work on the next part. Please post the xml for the output.
strRequest =""
strRequest =strRequest&"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ns1=""http://fedex.com/ws/ship/v13"">"
strRequest =strRequest&"...
Where you see single quotes you need to convert that to double quotes. Where you see, "input your information here" needs to be replaced with variables.
MyPassword = "abc123"
strRequest =strRequest&"<ns1:Password>“&MyPassword&”</ns1:Password>"
What I am not sure is if MyPassword needs to be quoted? Start coding this part on your own. You will need to set variables everywhere you see user input needed. The variables should all be at the top of the page.This is the part that takes you up to line 39 of my example. Once you get this far, try adding my example of the xmlhttp request which starts at line 43 to 53. Notice I have a strURL. That is another variable that needs to be defined at the top of the page. This is the url you are going to post to.
After this line, strResult = objXMLHTTP.responseText add one more line to send strResult to the screen for testing
response.write strResult.
See how far you can get from here. Work through your errors the best you can. If you can get output from strResult, we can work on the next part. Please post the xml for the output.
ASKER
Do I convert code like this?
<ns1:SpecialServicesReques ted>
to
strRequest =strRequest&"<SpecialServi cesRequest ed>"
or
strRequest =strRequest&"<ns1:SpecialS ervicesReq uested>"
or
not at all?
<ns1:SpecialServicesReques
to
strRequest =strRequest&"<SpecialServi
or
strRequest =strRequest&"<ns1:SpecialS
or
not at all?
strRequest =strRequest&"<ns1:SpecialS ervicesReq uested>"
A good way to test is to simply do a response.write strRequest when you are done and see if it looks exactly like the sample.
What this is doing is building an exact duplicate of the xml code but throwing it into one variable called strRequest. Then later on in the xmlhttpost, we will post the strRequest. This is how we post the xml/soap file.
A good way to test is to simply do a response.write strRequest when you are done and see if it looks exactly like the sample.
What this is doing is building an exact duplicate of the xml code but throwing it into one variable called strRequest. Then later on in the xmlhttpost, we will post the strRequest. This is how we post the xml/soap file.
ASKER
This is with : Response.Write(strRequest) then Response.Write(strResult)
xdxxxxxxxmvM2OoKMyPassword 510TestAcc ountAndMet er4016*** Express Domestic Shipping Request v13.***ship13002013-07-16T 05:14:28+0 0:00REGULA R_PICKUPPR IORITY_OVE RNIGHTYOUR _PACKAGING LB50Upperd eckerBusin essName123 4567890Add ress Line 1AustinTX73301USRecipient NameRecipient Company Name1234567890Address Line 1HerndonVA20171UStrueSENDE R51ACCOUNT NUM8USCODU SD150ANYCO MMON2DPDFP APER_7X4.7 5ACCOUNT11 1LB5202010 IN ERRORERRORprof1000Authenti cation Failed*** Express Domestic Shipping Request v13.***ship1300
xdxxxxxxxmvM2OoKMyPassword
Awesome! It worked!
You want to view source or maybe enclose it in a pre tag because what we need to see is the xml that is output. If you just look in the browser you will see only text.
You want to view source or maybe enclose it in a pre tag because what we need to see is the xml that is output. If you just look in the browser you will see only text.
<pre><%=strResult%></pre>
ASKER
How's this?
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v13">
<SOAP-ENV:Body>
<ns1:ProcessShipmentRequest>
<ns1:WebAuthenticationDetail>
<ns1:UserCredential>
<ns1:Key>xxxxxxxxxx</ns1:Key>
<ns1:Password>xxxxx</ns1:Password>
</ns1:UserCredential>
</ns1:WebAuthenticationDetail>
<ns1:ClientDetail>
<ns1:AccountNumber>xxxxxxx</ns1:AccountNumber>
<ns1:MeterNumber>xxxxxxx</ns1:MeterNumber>
</ns1:ClientDetail>
<ns1:TransactionDetail>
<ns1:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns1:CustomerTransactionId>
</ns1:TransactionDetail>
<ns1:Version>
<ns1:ServiceId>ship</ns1:ServiceId>
<ns1:Major>13</ns1:Major>
<ns1:Intermediate>0</ns1:Intermediate>
<ns1:Minor>0</ns1:Minor>
</ns1:Version>
<ns1:RequestedShipment>
<ns1:ShipTimestamp>2013-07-16T05:14:28+00:00</ns1:ShipTimestamp>
<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>
<ns1:ServiceType>PRIORITY_OVERNIGHT</ns1:ServiceType>
<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>
<ns1:TotalWeight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>50</ns1:Value>
</ns1:TotalWeight>
<ns1:Shipper>
<ns1:Contact>
<ns1:PersonName>Upperdecker</ns1:PersonName>
<ns1:CompanyName>My Company</ns1:CompanyName>
<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>
</ns1:Contact>
<ns1:Address>
<ns1:StreetLines>Address Line 1</ns1:StreetLines>
<ns1:City>Austin</ns1:City>
<ns1:StateOrProvinceCode>TX</ns1:StateOrProvinceCode>
<ns1:PostalCode>73301</ns1:PostalCode>
<ns1:CountryCode>US</ns1:CountryCode>
</ns1:Address>
</ns1:Shipper>
<ns1:Recipient>
<ns1:Contact>
<ns1:PersonName>Recipient Name</ns1:PersonName>
<ns1:CompanyName>Recipient Company Name</ns1:CompanyName>
<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>
</ns1:Contact>
<ns1:Address>
<ns1:StreetLines>Address Line 1</ns1:StreetLines>
<ns1:City>Herndon</ns1:City>
<ns1:StateOrProvinceCode>VA</ns1:StateOrProvinceCode>
<ns1:PostalCode>20171</ns1:PostalCode>
<ns1:CountryCode>US</ns1:CountryCode>
<ns1:Residential>true</ns1:Residential>
</ns1:Address>
</ns1:Recipient>
<ns1:ShippingChargesPayment>
<ns1:PaymentType>SENDER</ns1:PaymentType>
<ns1:Payor>
<ns1:ResponsibleParty>
<ns1:AccountNumber>xxxxxxxx</ns1:AccountNumber>
<ns1:Contact/>
<ns1:Address>
<ns1:CountryCode>US</ns1:CountryCode>
</ns1:Address>
</ns1:ResponsibleParty>
</ns1:Payor>
</ns1:ShippingChargesPayment>
<ns1:SpecialServicesRequested>
<ns1:SpecialServiceTypes>COD</ns1:SpecialServiceTypes>
<ns1:CodDetail>
<ns1:CodCollectionAmount>
<ns1:Currency>USD</ns1:Currency>
<ns1:Amount>150</ns1:Amount>
</ns1:CodCollectionAmount>
<ns1:CollectionType>ANY</ns1:CollectionType>
</ns1:CodDetail>
</ns1:SpecialServicesRequested>
<ns1:LabelSpecification>
<ns1:LabelFormatType>COMMON2D</ns1:LabelFormatType>
<ns1:ImageType>PDF</ns1:ImageType>
<ns1:LabelStockType>PAPER_7X4.75</ns1:LabelStockType>
</ns1:LabelSpecification>
<ns1:RateRequestTypes>ACCOUNT</ns1:RateRequestTypes>
<ns1:PackageCount>1</ns1:PackageCount>
<ns1:RequestedPackageLineItems>
<ns1:SequenceNumber>1</ns1:SequenceNumber>
<ns1:GroupPackageCount>1</ns1:GroupPackageCount>
<ns1:Weight>
<ns1:Units>LB</ns1:Units>
<ns1:Value>5</ns1:Value>
</ns1:Weight>
<ns1:Dimensions>
<ns1:Length>20</ns1:Length>
<ns1:Width>20</ns1:Width>
<ns1:Height>10</ns1:Height>
<ns1:Units>IN</ns1:Units>
</ns1:Dimensions>
</ns1:RequestedPackageLineItems>
</ns1:RequestedShipment>
</ns1:ProcessShipmentRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<pre><?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v13"><ns:ProcessShipmentReply xmlns:ns="http://fedex.com/ws/ship/v13"><ns:HighestSeverity>ERROR</ns:HighestSeverity><ns:Notifications><ns:Severity>ERROR</ns:Severity><ns:Source>prof</ns:Source><ns:Code>1000</ns:Code><ns:Message>Authentication Failed</ns:Message></ns:Notifications><ns:TransactionDetail><ns:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns:CustomerTransactionId></ns:TransactionDetail><ns:Version><ns:ServiceId>ship</ns:ServiceId><ns:Major>13</ns:Major><ns:Intermediate>0</ns:Intermediate><ns:Minor>0</ns:Minor></ns:Version></ns:ProcessShipmentReply></SOAP-ENV:Body></soapenv:Envelope>
</pre>
ASKER
Now what?
Now you read the data you want.
I have a simple sample using your output. Note: my post is going to be different, but the response is what we are after. I posted your response xml here http://jsbin.com/catopope/1.js to test.
Don't get frustrated with this. When I first tried using SOAP a long time ago it took me a long time to get this kind of thing working.
When accessing the return variables, it helps to know what the expected output is.
If you want the notification code, you would use
sample output
I have a simple sample using your output. Note: my post is going to be different, but the response is what we are after. I posted your response xml here http://jsbin.com/catopope/1.js to test.
<%
Dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
strURL = "http://jsbin.com/catopope/1.js"
objXMLHTTP.setTimeouts 10000, 60000 , 60000, 360000
objXMLHTTP.open "Get", "" & strURL & "" , False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.send(strRequest)
' ********* READ XML **************
Set objReturn = CreateObject("MSXML2.DOMDocument.3.0")
objReturn.loadXML objXMLHTTP.responseText
if objReturn.parseError.errorCode <> 0 then
' something did not go well, we have an error
set myErr = objReturn.parseError
response.write("You have error " & myErr.reason)
else
' the url was good, now read data
'*********** REPEAT FOR EACH VARIABLE ****************
' first, test the node to make sure it is good
if not objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0) is Nothing then
' it is good, assign a value to a variable
CustomerTransactionId= objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0).text
else
CustomerTransactionId="Error Matching"
end if
' DO SOMETHING WITH OUR VARIABLE FOR NOW WRITE TO SCREEN
response.write CustomerTransactionId
end if
' *************** REPEAT ABOVE FOR EACH VARIABLE ************
%>
For each of the variables you want to store or do something with, you will want to repeat what I have above. Don't get frustrated with this. When I first tried using SOAP a long time ago it took me a long time to get this kind of thing working.
When accessing the return variables, it helps to know what the expected output is.
If you want the notification code, you would use
NotificationCode= objReturn.getElementsByTagName("ns:Notifications/ns:Code").Item(0).text
sample output
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/ship/v13">
<ns:ProcessShipmentReply xmlns:ns="http://fedex.com/ws/ship/v13">
<ns:HighestSeverity>ERROR</ns:HighestSeverity>
<ns:Notifications>
<ns:Severity>ERROR</ns:Severity>
<ns:Source>prof</ns:Source>
<ns:Code>1000</ns:Code>
<ns:Message>Authentication Failed</ns:Message>
</ns:Notifications>
<ns:TransactionDetail>
<ns:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns:CustomerTransactionId>
</ns:TransactionDetail>
<ns:Version>
<ns:ServiceId>ship</ns:ServiceId>
<ns:Major>13</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
</ns:ProcessShipmentReply>
</SOAP-ENV:Body>
</soapenv:Envelope>
ASKER
No joy,
I'm getting: "Error Matching"
If i force it I get the error:
Microsoft VBScript runtime error '800a01a8'
Object required: 'objReturn.getElementsByTa gName(...) .Item(...) '
/apps/lean_ops/bookLibrary /api-page1 .asp, line 154
I'll be back on it Monday! Have a good weekend .
I'm getting: "Error Matching"
If i force it I get the error:
Microsoft VBScript runtime error '800a01a8'
Object required: 'objReturn.getElementsByTa
/apps/lean_ops/bookLibrary
I'll be back on it Monday! Have a good weekend .
Ok. Let's start with the sample code/url so we are on the same return object. Or past your rendered xml to look at.
ASKER
Using this url http://jsbin.com/catopope/1.js for my strURL I'm getting error:
"You have error End tag 'body' does not match the start tag 'hr'. "
I don't see any rendered xml .
"You have error End tag 'body' does not match the start tag 'hr'. "
I don't see any rendered xml .
What is the code you are using to send the request? What is the exact error with line number that matches your sample code. It sounds like you just have an issue with your html. Make sure your tags are closed properly. If you have to use http://validator.w3.org/
Below works for me. The error reads
Below works for me. The error reads
<%
Dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
strURL = "http://jsbin.com/catopope/1.js"
objXMLHTTP.setTimeouts 10000, 60000 , 60000, 360000
objXMLHTTP.open "Get", "" & strURL & "" , False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.send(strRequest)
Set objReturn = CreateObject("MSXML2.DOMDocument.3.0")
objReturn.loadXML objXMLHTTP.responseText
if objReturn.parseError.errorCode <> 0 then
set myErr = objReturn.parseError
response.write("You have error " & myErr.reason)
else
if not objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0) is Nothing then
TransactionsMatched= objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0).text
else
TransactionsMatched="0"
end if
response.write TransactionsMatched
end if
%>
ASKER
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
strRequest =""
strRequest =strRequest&"<?xml version=""1.0"" encoding=""UTF-8""?>"
strRequest =strRequest&"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ns1=""http://fedex.com/ws/ship/v13"">"
strRequest =strRequest&"<SOAP-ENV:Body>"
strRequest =strRequest&"<ns1:ProcessShipmentRequest>"
strRequest =strRequest&"<ns1:WebAuthenticationDetail>"
strRequest =strRequest&"<ns1:UserCredential>"
strRequest =strRequest&"<ns1:Key>xXXXXXXXXXX</ns1:Key>"
strRequest =strRequest&"<ns1:Password>XXXXX</ns1:Password>"
strRequest =strRequest&"</ns1:UserCredential>"
strRequest =strRequest&"</ns1:WebAuthenticationDetail>"
strRequest =strRequest&"<ns1:ClientDetail>"
strRequest =strRequest&"<ns1:AccountNumber>XXXXX68</ns1:AccountNumber>"
strRequest =strRequest&"<ns1:MeterNumber>11XXXXXX</ns1:MeterNumber>"
strRequest =strRequest&"</ns1:ClientDetail>"
strRequest =strRequest&"<ns1:TransactionDetail>"
strRequest =strRequest&"<ns1:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns1:CustomerTransactionId>"
strRequest =strRequest&"</ns1:TransactionDetail>"
strRequest =strRequest&"<ns1:Version>"
strRequest =strRequest&"<ns1:ServiceId>ship</ns1:ServiceId>"
strRequest =strRequest&"<ns1:Major>13</ns1:Major>"
strRequest =strRequest&"<ns1:Intermediate>0</ns1:Intermediate>"
strRequest =strRequest&"<ns1:Minor>0</ns1:Minor>"
strRequest =strRequest&"</ns1:Version>"
strRequest =strRequest&"<ns1:RequestedShipment>"
strRequest =strRequest&"<ns1:ShipTimestamp>2013-07-16T05:14:28+00:00</ns1:ShipTimestamp>"
strRequest =strRequest&"<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>"
strRequest =strRequest&"<ns1:ServiceType>PRIORITY_OVERNIGHT</ns1:ServiceType>"
strRequest =strRequest&"<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>"
strRequest =strRequest&"<ns1:TotalWeight>"
strRequest =strRequest&"<ns1:Units>LB</ns1:Units>"
strRequest =strRequest&"<ns1:Value>50</ns1:Value>"
strRequest =strRequest&"</ns1:TotalWeight>"
strRequest =strRequest&"<ns1:Shipper>"
strRequest =strRequest&"<ns1:Contact>"
strRequest =strRequest&"<ns1:PersonName>Upperdecker</ns1:PersonName>"
strRequest =strRequest&"<ns1:CompanyName>My Company</ns1:CompanyName>"
strRequest =strRequest&"<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>"
strRequest =strRequest&"</ns1:Contact>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:StreetLines>Address Line 1</ns1:StreetLines>"
strRequest =strRequest&"<ns1:City>Austin</ns1:City>"
strRequest =strRequest&"<ns1:StateOrProvinceCode>TX</ns1:StateOrProvinceCode>"
strRequest =strRequest&"<ns1:PostalCode>73301</ns1:PostalCode>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:Shipper>"
strRequest =strRequest&"<ns1:Recipient>"
strRequest =strRequest&"<ns1:Contact>"
strRequest =strRequest&"<ns1:PersonName>Recipient Name</ns1:PersonName>"
strRequest =strRequest&"<ns1:CompanyName>Recipient Company Name</ns1:CompanyName>"
strRequest =strRequest&"<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>"
strRequest =strRequest&"</ns1:Contact>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:StreetLines>Address Line 1</ns1:StreetLines>"
strRequest =strRequest&"<ns1:City>Herndon</ns1:City>"
strRequest =strRequest&"<ns1:StateOrProvinceCode>VA</ns1:StateOrProvinceCode>"
strRequest =strRequest&"<ns1:PostalCode>20171</ns1:PostalCode>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"<ns1:Residential>true</ns1:Residential>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:Recipient>"
strRequest =strRequest&"<ns1:ShippingChargesPayment>"
strRequest =strRequest&"<ns1:PaymentType>SENDER</ns1:PaymentType>"
strRequest =strRequest&"<ns1:Payor>"
strRequest =strRequest&"<ns1:ResponsibleParty>"
strRequest =strRequest&"<ns1:AccountNumber>XXXXX68</ns1:AccountNumber>"
strRequest =strRequest&"<ns1:Contact/>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:ResponsibleParty>"
strRequest =strRequest&"</ns1:Payor>"
strRequest =strRequest&"</ns1:ShippingChargesPayment>"
strRequest =strRequest&"<ns1:SpecialServicesRequested>"
strRequest =strRequest&"<ns1:SpecialServiceTypes>COD</ns1:SpecialServiceTypes>"
strRequest =strRequest&"<ns1:CodDetail>"
strRequest =strRequest&"<ns1:CodCollectionAmount>"
strRequest =strRequest&"<ns1:Currency>USD</ns1:Currency>"
strRequest =strRequest&"<ns1:Amount>150</ns1:Amount>"
strRequest =strRequest&"</ns1:CodCollectionAmount>"
strRequest =strRequest&"<ns1:CollectionType>ANY</ns1:CollectionType>"
strRequest =strRequest&"</ns1:CodDetail>"
strRequest =strRequest&"</ns1:SpecialServicesRequested>"
strRequest =strRequest&"<ns1:LabelSpecification>"
strRequest =strRequest&"<ns1:LabelFormatType>COMMON2D</ns1:LabelFormatType>"
strRequest =strRequest&"<ns1:ImageType>PDF</ns1:ImageType>"
strRequest =strRequest&"<ns1:LabelStockType>PAPER_7X4.75</ns1:LabelStockType>"
strRequest =strRequest&"</ns1:LabelSpecification>"
strRequest =strRequest&"<ns1:RateRequestTypes>ACCOUNT</ns1:RateRequestTypes>"
strRequest =strRequest&"<ns1:PackageCount>1</ns1:PackageCount>"
strRequest =strRequest&"<ns1:RequestedPackageLineItems>"
strRequest =strRequest&"<ns1:SequenceNumber>1</ns1:SequenceNumber>"
strRequest =strRequest&"<ns1:GroupPackageCount>1</ns1:GroupPackageCount>"
strRequest =strRequest&"<ns1:Weight>"
strRequest =strRequest&"<ns1:Units>LB</ns1:Units>"
strRequest =strRequest&"<ns1:Value>5</ns1:Value>"
strRequest =strRequest&"</ns1:Weight>"
strRequest =strRequest&"<ns1:Dimensions>"
strRequest =strRequest&"<ns1:Length>20</ns1:Length>"
strRequest =strRequest&"<ns1:Width>20</ns1:Width>"
strRequest =strRequest&"<ns1:Height>10</ns1:Height>"
strRequest =strRequest&"<ns1:Units>IN</ns1:Units>"
strRequest =strRequest&"</ns1:Dimensions>"
strRequest =strRequest&"</ns1:RequestedPackageLineItems>"
strRequest =strRequest&"</ns1:RequestedShipment>"
strRequest =strRequest&"</ns1:ProcessShipmentRequest>"
strRequest =strRequest&"</SOAP-ENV:Body>"
strRequest =strRequest&"</SOAP-ENV:Envelope>"
'https://wsbeta.fedex.com:443/web-services
'http://jsbin.com/catopope/1.js
Dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
strURL = "https://wsbeta.fedex.com:443/web-services"
objXMLHTTP.setTimeouts 10000, 60000 , 60000, 360000
objXMLHTTP.open "Get", "" & strURL & "" , False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.send(strRequest)
Set objReturn = CreateObject("MSXML2.DOMDocument.3.0")
objReturn.loadXML objXMLHTTP.responseText
if objReturn.parseError.errorCode <> 0 then
set myErr = objReturn.parseError
response.write("You have error " & myErr.reason)
else
if not objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0) is Nothing then
TransactionsMatched= objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0).text
else
TransactionsMatched="0"
end if
response.write TransactionsMatched
end if
%>
</body>
</html>
When I use "https://wsbeta.fedex.com:443/web-services" as strURL I get "0" returned.
When I use as strURL I get : http://jsbin.com/catopope/1.js
You have error End tag 'body' does not match the start tag 'hr'.
That is odd. I copied and pasted what you have and did not get an issue with jsbin and of course the 0 for fedex. What we care about is fedex though. The jsbin thing may be something else having to do with jsbin and using beyond it's means.
I was using jsbin just to test the response.
Let me give you some new sample code
I was using jsbin just to test the response.
Let me give you some new sample code
At least we know this works. This new code will output the xml in somewhat a nice form.
Now you need to plug in your api credentials. Do you have a sandbox account we can play with? In the documentation, check if you need to post or get. Most likely you will need to post. That just means changing objXMLHTTP.open "Get", "" & strURL & "" , False
Now you need to plug in your api credentials. Do you have a sandbox account we can play with? In the documentation, check if you need to post or get. Most likely you will need to post. That just means changing objXMLHTTP.open "Get", "" & strURL & "" , False
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
strRequest =""
strRequest =strRequest&"<?xml version=""1.0"" encoding=""UTF-8""?>"
strRequest =strRequest&"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ns1=""http://fedex.com/ws/ship/v13"">"
strRequest =strRequest&"<SOAP-ENV:Body>"
strRequest =strRequest&"<ns1:ProcessShipmentRequest>"
strRequest =strRequest&"<ns1:WebAuthenticationDetail>"
strRequest =strRequest&"<ns1:UserCredential>"
strRequest =strRequest&"<ns1:Key>xXXXXXXXXXX</ns1:Key>"
strRequest =strRequest&"<ns1:Password>XXXXX</ns1:Password>"
strRequest =strRequest&"</ns1:UserCredential>"
strRequest =strRequest&"</ns1:WebAuthenticationDetail>"
strRequest =strRequest&"<ns1:ClientDetail>"
strRequest =strRequest&"<ns1:AccountNumber>XXXXX68</ns1:AccountNumber>"
strRequest =strRequest&"<ns1:MeterNumber>11XXXXXX</ns1:MeterNumber>"
strRequest =strRequest&"</ns1:ClientDetail>"
strRequest =strRequest&"<ns1:TransactionDetail>"
strRequest =strRequest&"<ns1:CustomerTransactionId>*** Express Domestic Shipping Request v13.***</ns1:CustomerTransactionId>"
strRequest =strRequest&"</ns1:TransactionDetail>"
strRequest =strRequest&"<ns1:Version>"
strRequest =strRequest&"<ns1:ServiceId>ship</ns1:ServiceId>"
strRequest =strRequest&"<ns1:Major>13</ns1:Major>"
strRequest =strRequest&"<ns1:Intermediate>0</ns1:Intermediate>"
strRequest =strRequest&"<ns1:Minor>0</ns1:Minor>"
strRequest =strRequest&"</ns1:Version>"
strRequest =strRequest&"<ns1:RequestedShipment>"
strRequest =strRequest&"<ns1:ShipTimestamp>2013-07-16T05:14:28+00:00</ns1:ShipTimestamp>"
strRequest =strRequest&"<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>"
strRequest =strRequest&"<ns1:ServiceType>PRIORITY_OVERNIGHT</ns1:ServiceType>"
strRequest =strRequest&"<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>"
strRequest =strRequest&"<ns1:TotalWeight>"
strRequest =strRequest&"<ns1:Units>LB</ns1:Units>"
strRequest =strRequest&"<ns1:Value>50</ns1:Value>"
strRequest =strRequest&"</ns1:TotalWeight>"
strRequest =strRequest&"<ns1:Shipper>"
strRequest =strRequest&"<ns1:Contact>"
strRequest =strRequest&"<ns1:PersonName>Upperdecker</ns1:PersonName>"
strRequest =strRequest&"<ns1:CompanyName>My Company</ns1:CompanyName>"
strRequest =strRequest&"<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>"
strRequest =strRequest&"</ns1:Contact>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:StreetLines>Address Line 1</ns1:StreetLines>"
strRequest =strRequest&"<ns1:City>Austin</ns1:City>"
strRequest =strRequest&"<ns1:StateOrProvinceCode>TX</ns1:StateOrProvinceCode>"
strRequest =strRequest&"<ns1:PostalCode>73301</ns1:PostalCode>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:Shipper>"
strRequest =strRequest&"<ns1:Recipient>"
strRequest =strRequest&"<ns1:Contact>"
strRequest =strRequest&"<ns1:PersonName>Recipient Name</ns1:PersonName>"
strRequest =strRequest&"<ns1:CompanyName>Recipient Company Name</ns1:CompanyName>"
strRequest =strRequest&"<ns1:PhoneNumber>1234567890</ns1:PhoneNumber>"
strRequest =strRequest&"</ns1:Contact>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:StreetLines>Address Line 1</ns1:StreetLines>"
strRequest =strRequest&"<ns1:City>Herndon</ns1:City>"
strRequest =strRequest&"<ns1:StateOrProvinceCode>VA</ns1:StateOrProvinceCode>"
strRequest =strRequest&"<ns1:PostalCode>20171</ns1:PostalCode>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"<ns1:Residential>true</ns1:Residential>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:Recipient>"
strRequest =strRequest&"<ns1:ShippingChargesPayment>"
strRequest =strRequest&"<ns1:PaymentType>SENDER</ns1:PaymentType>"
strRequest =strRequest&"<ns1:Payor>"
strRequest =strRequest&"<ns1:ResponsibleParty>"
strRequest =strRequest&"<ns1:AccountNumber>XXXXX68</ns1:AccountNumber>"
strRequest =strRequest&"<ns1:Contact/>"
strRequest =strRequest&"<ns1:Address>"
strRequest =strRequest&"<ns1:CountryCode>US</ns1:CountryCode>"
strRequest =strRequest&"</ns1:Address>"
strRequest =strRequest&"</ns1:ResponsibleParty>"
strRequest =strRequest&"</ns1:Payor>"
strRequest =strRequest&"</ns1:ShippingChargesPayment>"
strRequest =strRequest&"<ns1:SpecialServicesRequested>"
strRequest =strRequest&"<ns1:SpecialServiceTypes>COD</ns1:SpecialServiceTypes>"
strRequest =strRequest&"<ns1:CodDetail>"
strRequest =strRequest&"<ns1:CodCollectionAmount>"
strRequest =strRequest&"<ns1:Currency>USD</ns1:Currency>"
strRequest =strRequest&"<ns1:Amount>150</ns1:Amount>"
strRequest =strRequest&"</ns1:CodCollectionAmount>"
strRequest =strRequest&"<ns1:CollectionType>ANY</ns1:CollectionType>"
strRequest =strRequest&"</ns1:CodDetail>"
strRequest =strRequest&"</ns1:SpecialServicesRequested>"
strRequest =strRequest&"<ns1:LabelSpecification>"
strRequest =strRequest&"<ns1:LabelFormatType>COMMON2D</ns1:LabelFormatType>"
strRequest =strRequest&"<ns1:ImageType>PDF</ns1:ImageType>"
strRequest =strRequest&"<ns1:LabelStockType>PAPER_7X4.75</ns1:LabelStockType>"
strRequest =strRequest&"</ns1:LabelSpecification>"
strRequest =strRequest&"<ns1:RateRequestTypes>ACCOUNT</ns1:RateRequestTypes>"
strRequest =strRequest&"<ns1:PackageCount>1</ns1:PackageCount>"
strRequest =strRequest&"<ns1:RequestedPackageLineItems>"
strRequest =strRequest&"<ns1:SequenceNumber>1</ns1:SequenceNumber>"
strRequest =strRequest&"<ns1:GroupPackageCount>1</ns1:GroupPackageCount>"
strRequest =strRequest&"<ns1:Weight>"
strRequest =strRequest&"<ns1:Units>LB</ns1:Units>"
strRequest =strRequest&"<ns1:Value>5</ns1:Value>"
strRequest =strRequest&"</ns1:Weight>"
strRequest =strRequest&"<ns1:Dimensions>"
strRequest =strRequest&"<ns1:Length>20</ns1:Length>"
strRequest =strRequest&"<ns1:Width>20</ns1:Width>"
strRequest =strRequest&"<ns1:Height>10</ns1:Height>"
strRequest =strRequest&"<ns1:Units>IN</ns1:Units>"
strRequest =strRequest&"</ns1:Dimensions>"
strRequest =strRequest&"</ns1:RequestedPackageLineItems>"
strRequest =strRequest&"</ns1:RequestedShipment>"
strRequest =strRequest&"</ns1:ProcessShipmentRequest>"
strRequest =strRequest&"</SOAP-ENV:Body>"
strRequest =strRequest&"</SOAP-ENV:Envelope>"
'https://wsbeta.fedex.com:443/web-services
'http://jsbin.com/catopope/1.js
Dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
strURL = "https://wsbeta.fedex.com:443/web-services"
objXMLHTTP.setTimeouts 10000, 60000 , 60000, 360000
objXMLHTTP.open "Get", "" & strURL & "" , False
objXMLHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objXMLHTTP.setRequestHeader "Content-Length", Len(strRequest)
objXMLHTTP.send(strRequest)
' ******* FOR TESTING ONLY *********
code = strRequest
code = replace(code,"&","&")
code = replace(code,"<","<")
code = replace(code,">",">")
code = replace(code,"><","><br><")
response.write code
' *************************************
Set objReturn = CreateObject("MSXML2.DOMDocument.3.0")
objReturn.loadXML objXMLHTTP.responseText
if objReturn.parseError.errorCode <> 0 then
set myErr = objReturn.parseError
response.write("You have error " & myErr.reason)
else
if not objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0) is Nothing then
TransactionsMatched= objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0).text
else
TransactionsMatched="0"
end if
response.write TransactionsMatched
end if
%>
</body>
</html>
ASKER
Good Morning,
Unfortunately I'm behind a firewall and have no external sandbox to speak of .
When I "Post" I get "*** Express Domestic Shipping Request v13.***"
With the additional code I can see the xml displayed.
Unfortunately I'm behind a firewall and have no external sandbox to speak of .
When I "Post" I get "*** Express Domestic Shipping Request v13.***"
With the additional code I can see the xml displayed.
You need to sign up with fed ex and they should have a testing sandbox account or special url with a username and log in. Otherwise, I have brought you as far as you can go. You are making the post and getting a response.
ASKER
Oh, yes I guess I do have a sandbox. "Test Account Number" "Test Meter Number" Should I post that info on this site ? ?
If it is personal to you, then I wouldn't suggest it. If it is published on the site where everybody has the same testing account, then ok. But the main thing is you use that to test. By using my sample data, I can see that what I gave you works. Plug in your user info and data.
For each item you want to extract, you can use the same thing I have done below. Just notice how the "ns:TransactionDetail/ns:C ustomerTra nsactionId " mimics the position in the xml document.
For each item you want to extract, you can use the same thing I have done below. Just notice how the "ns:TransactionDetail/ns:C
if not objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0) is Nothing then
TransactionsMatched= objReturn.getElementsByTagName("ns:TransactionDetail/ns:CustomerTransactionId").Item(0).text
else
TransactionsMatched="0"
end if
ASKER
How can I tell where the info is going? Did the code create a tracking number in dev?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am working on it however I will be out of the office for the next week. I don't want you to think I abandoned this question. Thanks for your patients.
Ok, have a good vacation
ASKER
I am back, will work on this tomorrow.