2

我正在尝试使用 DHL XML 服务请求取件。但是在给出值并使用以下代码后,我得到了错误,即 Error108System Unavailable。我该如何解决这个问题。是因为代码错误还是服务器没有响应。

request_pickup.php

<?php
$xml = file_get_contents('post_xml.xml');
$url = 'https://xmlpitest-ea.dhl.com/XMLShippingServlet/';


$post_data = array(
    "xml" => $xml,
);

$stream_options = array(
    'http' => array(
       'method'  => 'POST',
       'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
       'content' => http_build_query($post_data),
    ),
);

$context  = stream_context_create($stream_options);
$response = file_get_contents($url, null, $context);

var_dump($response);

另一个xml文件是

<?xml version="1.0" encoding="UTF-8"?>
<req:BookPURequest xmlns:req="http://www.dhl.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com
 book-pickup-global-req.xsd" schemaVersion="1.0">
       <Request>
        <ServiceHeader>
            <MessageTime>2013-08-03T09:30:47-05:00</MessageTime>
            <MessageReference>Esteemed Courier Service of DHL</MessageReference>
            <SiteID>xmlPRONTOEQ</SiteID>
            <Password>g8xicHyl5r</Password>
        </ServiceHeader>
    </Request>
    <RegionCode>AM</RegionCode>
    <Requestor>
        <AccountType>D</AccountType>
        <RequestorContact>
            <PersonName>Rikhil</PersonName>
            <Phone>23162</Phone>
        </RequestorContact>
    </Requestor>
    <Place>
        <LocationType>B</LocationType>
        <CompanyName>String</CompanyName>
        <Address1>String</Address1>
        <Address2>norfolk+st</Address2>
        <PackageLocation>String</PackageLocation>
        <City>String</City>
        <StateCode>CA</StateCode>
        <DivisionName>sd</DivisionName>
        <CountryCode>BR</CountryCode>
        <PostalCode>66810</PostalCode>
    </Place>
    <Pickup>
        <PickupDate>2013-10-19</PickupDate>
        <ReadyByTime>10:20</ReadyByTime>
        <CloseTime>09:20</CloseTime>
        <AfterHoursClosingTime>11:20</AfterHoursClosingTime>
        <AfterHoursLocation>String</AfterHoursLocation>
        <Pieces>2</Pieces>
        <weight>
            <Weight>20</Weight>
            <WeightUnit>L</WeightUnit>
        </weight>
    </Pickup>
    <PickupContact>
        <PersonName>Subhayu</PersonName>
        <Phone>4801313131</Phone>
    </PickupContact>
    <ShipmentDetails>
        <AccountType>C</AccountType>
        <AccountNumber>851624480</AccountNumber>
        <ChargeCard>
            <ChargeCardNo>232311212312311</ChargeCardNo>
            <ChargeCardType>VI</ChargeCardType>
            <ChargeCardExpiryDate>1206</ChargeCardExpiryDate>
        </ChargeCard>
        <BillToAccountNumber>100000000</BillToAccountNumber>
        <AWBNumber>7520067111</AWBNumber>
        <NumberOfPieces>1</NumberOfPieces>
        <Weight>10</Weight>
        <WeightUnit>L</WeightUnit>
        <GlobalProductCode>D</GlobalProductCode>
        <DoorTo>DD</DoorTo>
        <DimensionUnit>I</DimensionUnit>
        <InsuredAmount>999999.99</InsuredAmount>
        <InsuredCurrencyCode>USD</InsuredCurrencyCode>
        <Pieces>
            <Weight>10</Weight>
            <Width>2</Width>
            <Height>2</Height>
            <Depth>2</Depth>
        </Pieces>
        <SpecialService>S</SpecialService>
        <SpecialService>I</SpecialService>
    </ShipmentDetails>
    <ShipmentDetails>
        <AccountType>D</AccountType>
        <AccountNumber>846737292</AccountNumber>
        <BillToAccountNumber>846737292</BillToAccountNumber>
        <AWBNumber>7520067111</AWBNumber>
        <NumberOfPieces>1</NumberOfPieces>
        <Weight>10</Weight>
        <WeightUnit>L</WeightUnit>
        <GlobalProductCode>D</GlobalProductCode>
        <DoorTo>DD</DoorTo>
        <DimensionUnit>I</DimensionUnit>
        <InsuredAmount>50</InsuredAmount>
        <InsuredCurrencyCode>USD</InsuredCurrencyCode>
        <Pieces>
            <Weight>10</Weight>
            <Width>2</Width>
            <Height>2</Height>
            <Depth>2</Depth>
        </Pieces>
        <SpecialService>S</SpecialService>
    </ShipmentDetails> 
</req:BookPURequest>
4

0 回答 0