Solved

FedEx Create Shipment api for classic asp

Posted on 2014-04-29
31
922 Views
Last Modified: 2014-12-20
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
0
Comment
Question by:Upperdecker
  • 13
  • 13
  • 2
31 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 40030800
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.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40030804
if you're able to use PHP, I found this existing class to use with FedEx:

http://sourceforge.net/projects/fedexdc/files/fedexdc/
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40030973
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.
http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_28418684.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

Open in new window



If you can post which webservice you are going after and the SOAP/REST documentation we can help you in detail.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:Upperdecker
ID: 40034696
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:
<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>

Open in new window

0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40034799
That looks like what you need.  Now start coding to asp/vb.

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&"...

Open in new window

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>"

Open in new window

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.
0
 

Author Comment

by:Upperdecker
ID: 40034847
Do I convert code like this?

<ns1:SpecialServicesRequested>
to
strRequest =strRequest&"<SpecialServicesRequested>"
or
strRequest =strRequest&"<ns1:SpecialServicesRequested>"
or
not at all?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40034918
strRequest =strRequest&"<ns1:SpecialServicesRequested>"

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.
0
 

Author Comment

by:Upperdecker
ID: 40035215
This is with : Response.Write(strRequest) then  Response.Write(strResult)

xdxxxxxxxmvM2OoKMyPassword510TestAccountAndMeter4016*** Express Domestic Shipping Request v13.***ship13002013-07-16T05:14:28+00:00REGULAR_PICKUPPRIORITY_OVERNIGHTYOUR_PACKAGINGLB50UpperdeckerBusinessName1234567890Address Line 1AustinTX73301USRecipient NameRecipient Company Name1234567890Address Line 1HerndonVA20171UStrueSENDER51ACCOUNTNUM8USCODUSD150ANYCOMMON2DPDFPAPER_7X4.75ACCOUNT111LB5202010IN ERRORERRORprof1000Authentication Failed*** Express Domestic Shipping Request v13.***ship1300
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40035314
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.
<pre><%=strResult%></pre>

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40035344
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>

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40035715
Now what?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40035908
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.  

<%


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 ************
%>

Open in new window

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

Open in new window


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>

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40038280
No joy,

I'm getting:  "Error Matching"

If i force it I get the error:

Microsoft VBScript runtime error '800a01a8'

Object required: 'objReturn.getElementsByTagName(...).Item(...)'

/apps/lean_ops/bookLibrary/api-page1.asp, line 154

 I'll be back on it Monday! Have a good weekend .
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40038308
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.
0
 

Author Comment

by:Upperdecker
ID: 40042721
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 .
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40042766
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
<%


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
%>

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40042848
<%@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>

Open in new window


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'.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40042953
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
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40042960
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

<%@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,"&","&amp;")
 code = replace(code,"<","&lt")
 code = replace(code,">","&gt")
 code = replace(code,"&gt&lt","&gt<br>&lt")
     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>

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40044481
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.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40044664
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.
0
 

Author Comment

by:Upperdecker
ID: 40044702
Oh, yes I guess I do have a sandbox. "Test Account Number"  "Test Meter Number" Should I post that info on this site ? ?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40044748
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:CustomerTransactionId" mimics the position in the xml document.  
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

Open in new window

0
 

Author Comment

by:Upperdecker
ID: 40045332
How can I tell where the info is going?  Did the code create a tracking number in dev?
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 40045437
You have to look at the xml response.  
' ******* FOR TESTING ONLY  *********  

 code =	strRequest

 code = replace(code,"&","&amp;")
 code = replace(code,"<","&lt")
 code = replace(code,">","&gt")
 code = replace(code,"&gt&lt","&gt<br>&lt")
     response.write code
' ************************************* 

Open in new window


Then for each element you want to do something with like save to your db
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

Open in new window


Before you can get a response, you have to fill in the data that gets posted.
strRequest =strRequest&"<ns1:Key>xXXXXXXXXXX</ns1:Key>"

Open in new window

will probably be
dim myKey
myKeay = "your_own_key"
strRequest =strRequest&"<ns1:Key>"&myKeay&"</ns1:Key>"

Open in new window

You will have to create a variable for each of the input items.  I would set all my variables before building the xml like this
dim myKey, myPassword, sendToName, sendToAddress, sendToCity
' assume all comes from a database 
myKey                = "Your_fed_ex_key"
myPassword       = "Your_fed_ex_password"
sendToName      = rs("SendToName")
sendToAddress   = rs("SendToAddress")
sendToCity         = rs("SendToCity")
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>"

Open in new window

You have a lot of coding to do.  This first part was just to make sure it works using static data.  I would save this page and start a new page with the dynamic coding.
0
 

Author Comment

by:Upperdecker
ID: 40051268
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.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40051303
Ok, have a good vacation
0
 

Author Comment

by:Upperdecker
ID: 40065384
I am back, will work on this tomorrow.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question