我从未使用过xml,这是我第一次使用api,所以这对我来说是非常新的。本质上,我试图将测试信息放入FedEx api中,以便可以打印出运输标签。我不知道如何将结果保存到变量中并将其放在可单击的链接上,用户可以在该链接上单击它,它会为他们显示pdf图像,以便他们可以打印出此运输标签。
这是我的代码在这里:
$path_to_wsdl = $_SERVER['DOCUMENT_ROOT'] . "/dashboard/website/ShipService_v23.wsdl";
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'ParentCredential' => array (
'Key' => 'XXXX',
'Password' => 'XXXX'
),
'UserCredential' => array(
'Key' => 'XXXX',
'Password' => 'XXXX'
)
);
$request['ClientDetail'] = array(
'AccountNumber' => 'XXXX',
'MeterNumber' => 'XXXX'
);
$request['Version'] = array(
'ServiceId' => 'ship',
'Major' => '23',
'Intermediate' => '0',
'Minor' => '0'
);
$request['RequestedShipment'] = array(
'ShipTimestamp' => '2017-12-14T12:34:56-06:00',
'DropoffType' => 'REGULAR_PICKUP',
'ServiceType' => 'STANDARD_OVERNIGHT',
'PackagingType' => 'FEDEX_BOX',
'Shipper' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'Bob Jones',
'CompanyName' => 'New Company',
'PhoneNumber' => '555-555-5555',
'EMailAddress' => 'example@example.com'
),
'Address' => array(
'StreetLines' => '1202 Chalet Ln',
'City' => 'Harrison',
'StateOrProvinceCode' => 'AR',
'PostalCode' => '72601',
'CountryCode' => 'US'
)
),
'Recipient' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'My Name',
'CompanyName' => 'Another Company',
'PhoneNumber' => '555-555-5555',
'EMailAddress' => 'another@example.com'
),
'Address' => array(
'StreetLines' => '123 Test St',
'City' => 'Test City',
'StateOrProvinceCode' => 'CA',
'PostalCode' => '12345',
'CountryCode' => 'US'
)),
'ShippingChargesPayment' => array(
'PaymentType' => 'SENDER',
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'My Name',
'EMailAddress' => 'another@example.com'
)
)
)
),
'LabelSpecification' => array(
'LabelFormatType' => 'COMMON2D',
'ImageType' => 'ZPLII',
'LabelStockType' => 'STOCK_4X6.75_LEADING_DOC_TAB',
'CustomerSpecifiedDetail' => array(
'DocTabContent' => array(
'DocTabContentType' => 'CUSTOM',
'Zone001' => array(
'DocTabZoneSpecifications' => array(
'ZoneNumber' => '201',
'Header' => 'rapidum iaculata',
'DataField' => 'Premere et',
'LiteralValue' => 'Insuper altos',
'Justification' => 'LEFT'
)
)
),
'CustomContentPosition' => 'BELOW',
'CustomContent' => array(
'CoordinateUnits' => 'PIXELS',
'GraphicEntries' => array(
'Position' => array(
'X' => '200',
'Y' => '3'
),
'PrinterGraphicId' => 'aeoliam venit',
'FileGraphicFullName' => 'altos imposuit regemque'
),
'BoxEntries' => array(
'TopLeftCorner' => array(
'X' => '200',
'Y' => '3'
),
'BottomRightCorner' => array(
'X' => '200',
'Y' => '3'
)),
'TextBoxEntries' => array(
'TopLeftCorner' => array(
'X' => '200',
'Y' => '3'
),
'BottomRightCorner' => array(
'X' => '200',
'Y' => '3'
),
'Position' => array(
'X' => '200',
'Y' => '3'
),
'Format' => 'profundum quippe',
'DataFields' => 'premit ac vinclis',
'ThermalFontId' => 'lunctantis ventos',
'FontName' => 'luctantis ventos tempestateque',
'FontSize' => '201',
'Rotation' => 'NONE'
),
'BarcodeEntries' => array(
'Position' => array(
'X' => '200',
'Y' => '3'
),
'Format' => 'altos imposuit',
'DataFields' => 'sonoras imperio premit',
'BarHeight' => '3',
'ThinBarWidth' => '3',
'BarcodeSymbology' => 'CODE128C'
)
)
)
),
'RateRequestTypes' => 'LIST',
'PackageCount' => '1',
'RequestedPackageLineItems' => array(
'SequenceNumber' => '1',
'Weight' => array(
'Units' => 'LB',
'Value' => '40'
),
'Dimensions' => array(
'Length' => '5',
'Width' => '5',
'Height' => '5',
'Units' => 'IN',
),
'PhysicalPackaging' => 'BAG',
'ItemDescription' => 'Phone',
'CustomerReferences' => array(
'CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => 'NAFTA_COO'
)
)
);
谢谢。