我正在尝试使用基本身份验证连接到PHP中的DHL ELP Web服务。如何使用PHP发送用户名和密码并将自己验证到DHL的Web服务?
在SOAP UI中,我能够连接并发出请求/修改/取消。
任何帮助将不胜感激。谢谢。
请参阅我的代码:
class TypeElpProcess{
var $Security;//TypeSecurity
var $Command;//TypeCommand
var $Data;//TypeData
}
class TypeSecurity{
}
class TypeCommand{
var $Name;//_x0040_Name
var $DirectRelease;//TypeFlag
var $NextBusinessDay;//TypeFlag
var $CompletePreviousLeg;//TypeFlag
var $IncludePaperwork;//TypeFlag
var $CalendarNoOfDays;//decimal
var $CallMethod;//_x0040_CallMethod
}
class TypeData{
var $OrderDetails;//TypeOrderDetails
var $OrderAdditionInformation;//TypeAdditionalInfo
var $ShipmentDetails;//TypeShipmentDetails
var $Pieces;//TypePiece
var $ShipperAddressSegment;//TypeAddress
var $PickupAddressSegment;//TypeAddress
var $ReturnLegDeliveryAddressSegment;//TypeAddress
var $PackagingLegDeliveryAddressSegment;//TypeAddress
var $RepairVendorAddressSegment;//TypeAddress
var $PackageSupplierAddressSegment;//TypeAddress
var $Notification;//TypeNotification
var $Query;//TypeQuery
}
class TypeOrderDetails{
var $RMANo;//_x0040_RMANo
var $ShipperReferenceNo;//_x0040_ShipperReferenceNo
var $BookingReferenceNo;//_x0040_BookingReferenceNo
var $OrderNo;//_x0040_OrderNo
var $DCNo;//_x0040_DCNo
var $SiteNo;//_x0040_SiteNo
var $ProtocolNo;//_x0040_ProtocolNo
var $ProjectNo;//_x0040_ProjectNo
var $CustomerProgramId;//_x0040_CustomerProgramId
var $Booking_Language;//_x0040_Booking_Language
var $EDI_Notification_Email;//_x0040_EDI_Notification_Email
var $ProcessType;//_x0040_ProcessType
var $ShowAccNoOnLabel;//TypeFlag
var $UseSwapScenario;//TypeFlag
}
class TypeAdditionalInfo{
var $AtNm;//_x0040_AtNm
var $AtVal;//_x0040_AtVal
}
class TypeShipmentDetails{
var $DangerousGoods;//TypeDangerousGoods
var $CustomsHandling;//TypeCustomsHandling
var $PayerAddressSegement;//TypePayerAddressSegement
var $Services;//TypeService
var $Paperwork;//TypePaperworks
var $ShipmentAdditionInformation;//TypeAdditionalInfo
var $Pieces;//TypePiece
var $Leg;//_x0040_Leg
var $MgNProdCd;//_x0040_MgNProdCd
var $PlannedPuDt;//TypeDateString
var $ActualPuDt;//TypeDateString
var $PlannedDelDtm;//TypeDateTimeString
var $ActualDlvDtm;//TypeDateTimeString
var $ReadyTm;//time
var $CloseTm;//time
var $DeliveryTm;//time
var $PuCutOffTm;//time
var $LatestBookingTm;//time
var $TransitDays;//decimal
var $MinBoxDryIceDurationDays;//decimal
var $CalendarViewResponseId;//decimal
var $ShpId;//_x0040_ShpId
var $OrgSrvaCd;//TypeCode3
var $OrgFcCd;//TypeCode3
var $DstSrvaCd;//TypeCode3
var $DstFcCd;//TypeCode3
var $PuTourId;//_x0040_PuTourId
var $DscGds;//_x0040_DscGds
var $InsVal;//_x0040_InsVal
var $InsValCurCd;//TypeCode3
var $SendPaperwork_EmailFlag;//TypeFlag
var $SendPaperwork_SMSFlag;//TypeFlag
var $SendPaperwork_FAXFlag;//TypeFlag
var $DangerousGoodsContactNm;//_x0040_DangerousGoodsContactNm
var $DangerousGoodsContactPhone;//_x0040_DangerousGoodsContactPhone
var $DoBooking;//TypeFlag
var $BookingReference;//_x0040_BookingReference
}
class TypeDangerousGoods{
var $DangerousGoodsCode;//_x0040_DangerousGoodsCode
}
class TypeCustomsHandling{
var $CustomsDocuments;//TypeCustomsDocument
var $CustomsItem;//TypeCustomsItem
var $TotGWgt;//TypeWeight
var $TrmTrdCd;//TypeCode3
var $RefNo;//_x0040_RefNo
var $ExprtRsn;//_x0040_ExprtRsn
var $TypeOfExport;//_x0040_TypeOfExport
var $CustVal;//_x0040_CustVal
var $CustValCurCd;//TypeCode3
var $CustRmk;//_x0040_CustRmk
var $ProformaInvoice;//TypeFlag
var $CommercialInvoice;//TypeFlag
}
class TypeCustomsDocument{
var $Format;//_x0040_Format
var $CustDoc;//base64Binary
}
class TypeCustomsItem{
var $CntnDsc;//_x0040_CntnDsc
var $PtNo;//_x0040_PtNo
var $CurCd;//TypeCode3
var $COfManCd;//TypeCode2
var $CntnVal;//_x0040_CntnVal
var $CntnQnt;//_x0040_CntnQnt
var $CntnNetWgt;//TypeWeight
var $CmdtCd;//_x0040_CmdtCd
}
class TypePayerAddressSegement{
var $Zip;//_x0040_Zip
var $StrNo;//_x0040_StrNo
var $StrNm;//_x0040_StrNm
var $SCBldNm;//_x0040_SCBldNm
var $CustNm;//_x0040_CustNm
var $CtyNm;//_x0040_CtyNm
var $CtryCd;//TypeCode2
var $CtryDivNm;//_x0040_CtryDivNm
var $CntNm;//_x0040_CntNm
var $Ref;//_x0040_Ref
var $AccNo;//_x0040_AccNo
}
class TypeService{
var $SrvCd;//TypeCode2
}
class TypePaperworks{
var $Format;//_x0040_Format2
var $PprwrkData;//_x0040_PprwrkData
}
class TypePiece{
var $PcsId;//_x0040_PcsId
var $DclW;//TypeMeasure
var $DclWgt;//TypeWeight
var $DclL;//TypeMeasure
var $DclH;//TypeMeasure
var $CDUom;//TypeCode3
var $CWgtUom;//TypeCode3
var $CaseId;//_x0040_CaseId
var $OptionalSupplyId;//_x0040_OptionalSupplyId
}
class TypeAddress{
var $CommunicationDevice;//TypeCommunicationDevice
var $Id;//_x0040_Id
var $AddrBookMatchCode;//_x0040_AddrBookMatchCode
var $Zip;//_x0040_Zip2
var $StrNo;//_x0040_StrNo2
var $StrNm;//_x0040_StrNm2
var $SCBldNm;//_x0040_SCBldNm2
var $CustNm;//_x0040_CustNm2
var $CtyNm;//_x0040_CtyNm2
var $Dist;//_x0040_Dist
var $CtryCd;//TypeCode2
var $CtryDivNm;//_x0040_CtryDivNm2
var $CntNm;//_x0040_CntNm2
var $Ref;//_x0040_Ref2
var $Phone;//_x0040_Phone
var $Fax;//_x0040_Fax
var $Mobile;//_x0040_Mobile
var $Email;//_x0040_Email
}
class TypeCommunicationDevice{
var $DevTyCd;//_x0040_DevTyCd
var $DevNo;//_x0040_DevNo
}
class TypeNotification{
var $code;//_x0040_code
var $message;//_x0040_message
}
class TypeQuery{
var $createDT_From;//_x0040_createDT_From
var $createDT_To;//_x0040_createDT_To
var $PuDT_From;//_x0040_PuDT_From
var $PuDT_To;//_x0040_PuDT_To
}
class TypeElpProcessResponse{
var $Security;//TypeSecurity
var $Command;//TypeCommand
var $Data;//TypeResponse
}
class TypeResponse{
var $RequestData;//TypeData
var $ResponseData;//TypeData
}
class BookingElpEntry{
var $ElpProcess;//TypeElpProcess
}
class BookingElpEntryResponse{
var $ElpProcessResponse;//TypeElpProcessResponse
}
class dhl
{
var $soapClient;
private static $classmap = array('TypeElpProcess'=>'TypeElpProcess'
,'TypeSecurity'=>'TypeSecurity'
,'TypeCommand'=>'TypeCommand'
,'TypeData'=>'TypeData'
,'TypeOrderDetails'=>'TypeOrderDetails'
,'TypeAdditionalInfo'=>'TypeAdditionalInfo'
,'TypeShipmentDetails'=>'TypeShipmentDetails'
,'TypeDangerousGoods'=>'TypeDangerousGoods'
,'TypeCustomsHandling'=>'TypeCustomsHandling'
,'TypeCustomsDocument'=>'TypeCustomsDocument'
,'TypeCustomsItem'=>'TypeCustomsItem'
,'TypePayerAddressSegement'=>'TypePayerAddressSegement'
,'TypeService'=>'TypeService'
,'TypePaperworks'=>'TypePaperworks'
,'TypePiece'=>'TypePiece'
,'TypeAddress'=>'TypeAddress'
,'TypeCommunicationDevice'=>'TypeCommunicationDevice'
,'TypeNotification'=>'TypeNotification'
,'TypeQuery'=>'TypeQuery'
,'TypeElpProcessResponse'=>'TypeElpProcessResponse'
,'TypeResponse'=>'TypeResponse'
,'BookingElpEntry'=>'BookingElpEntry'
,'BookingElpEntryResponse'=>'BookingElpEntryResponse'
);
function __construct($url='https://wsbexpressuat.dhl.com/ws/euDcgFramework.BookingELP.services:BookingElpSrvcProvider?wsdl')
{
$this->soapClient = new SoapClient($url,array("classmap"=>self::$classmap,"trace" => true,"exceptions" => true));
}
function BookingElpEntry(BookingElpEntry $BookingElpEntry)
{
$BookingElpEntryResponse = $this->soapClient->BookingElpEntry($BookingElpEntry);
return $BookingElpEntryResponse;
}
}