PDA

View Full Version : complex HTTP Post problem



Dan Walsh
18-Jun-2005, 09:31 AM
The following is from UPS's developer guide. They are very specific
that the two XML documents must be concatenated and posted with a single
HTTP post. I know how to create the two documents, but how to
concatenate & post with one handle. Is this possible in DataFlex?

from UPS: -- I've abbreviated the 2nd document description

XML Rates & Service Selection Examples
The following are fabricated XML documents showing Rates & Service
Selection Requests and Responses used in communicating with UPS OnLine
Tools server.

Each transaction is made up of two separate XML request documents. These
requests are concatenated and posted to the UPS web servers using a
single HTTP Post.

When validating the request XML documents, do not treat the two
concatenated documents as a single XML document. XML parsers can not
parse two concatenated documents. Process each XML Request separately.

UPS will separate the two documents and parse them individually. To
ensure this occurs, verify that <?xml version="1.0"?> is at the top of
each XML request document.

Request #1: Simple Rates and Service Selection Request
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
<UserId>YOURUSERID</UserId>
<Password>YOURPASSWORD</Password>
</AccessRequest>
<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
</Request>

Dan Walsh
18-Jun-2005, 10:17 AM
FWIW, the cXMLDomDocument class is not easily tricked.

Dan Walsh wrote:
> The following is from UPS's developer guide. They are very specific
> that the two XML documents must be concatenated and posted with a single
> HTTP post. I know how to create the two documents, but how to
> concatenate & post with one handle. Is this possible in DataFlex?
>
> from UPS: -- I've abbreviated the 2nd document description
>
> XML Rates & Service Selection Examples
> The following are fabricated XML documents showing Rates & Service
> Selection Requests and Responses used in communicating with UPS OnLine
> Tools server.
>
> Each transaction is made up of two separate XML request documents. These
> requests are concatenated and posted to the UPS web servers using a
> single HTTP Post.
>
> When validating the request XML documents, do not treat the two
> concatenated documents as a single XML document. XML parsers can not
> parse two concatenated documents. Process each XML Request separately.
>
> UPS will separate the two documents and parse them individually. To
> ensure this occurs, verify that <?xml version="1.0"?> is at the top of
> each XML request document.
>
> Request #1: Simple Rates and Service Selection Request
> <?xml version="1.0"?>
> <AccessRequest xml:lang="en-US">
> <AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
> <UserId>YOURUSERID</UserId>
> <Password>YOURPASSWORD</Password>
> </AccessRequest>
> <?xml version="1.0"?>
> <RatingServiceSelectionRequest xml:lang="en-US">
> <Request>
> </Request>

Dan Walsh
18-Jun-2005, 10:38 AM
Posting as a string would seem to be the answer. I could save the two
documents as temp files, readln them into strings. The strings would be
concatenated. Going from the DOM object directly to a string would be
easier. Any comment on that?

Dan Walsh wrote:
> The following is from UPS's developer guide. They are very specific
> that the two XML documents must be concatenated and posted with a single
> HTTP post. I know how to create the two documents, but how to
> concatenate & post with one handle. Is this possible in DataFlex?
>
> from UPS: -- I've abbreviated the 2nd document description
>
> XML Rates & Service Selection Examples
> The following are fabricated XML documents showing Rates & Service
> Selection Requests and Responses used in communicating with UPS OnLine
> Tools server.
>
> Each transaction is made up of two separate XML request documents. These
> requests are concatenated and posted to the UPS web servers using a
> single HTTP Post.
>
> When validating the request XML documents, do not treat the two
> concatenated documents as a single XML document. XML parsers can not
> parse two concatenated documents. Process each XML Request separately.
>
> UPS will separate the two documents and parse them individually. To
> ensure this occurs, verify that <?xml version="1.0"?> is at the top of
> each XML request document.
>
> Request #1: Simple Rates and Service Selection Request
> <?xml version="1.0"?>
> <AccessRequest xml:lang="en-US">
> <AccessLicenseNumber>YOURACCESSLICENSENUMBER</AccessLicenseNumber>
> <UserId>YOURUSERID</UserId>
> <Password>YOURPASSWORD</Password>
> </AccessRequest>
> <?xml version="1.0"?>
> <RatingServiceSelectionRequest xml:lang="en-US">
> <Request>
> </Request>