2016-08-02 14 views
0

Ich möchte nach erfolgreicher Bestellung in meinem Webshop Versandaufkleber erstellen. Mein lokaler Paketservice hat einen Webservice, der SOAP verwendet. Aber sie können mir kein verständliches Codebeispiel liefern.PHP SOAP shippinglabelservice

Eine Arbeits XML-Anforderung wie folgt aussieht:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org 

/soap/envelope/" xmlns:post="http://post.ondot.at" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:core="http://Core.Model" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <post:ImportShipment> 
     <!--Optional:--> 
     <post:row> 
    <post:ClientID>xxx</post:ClientID> 
     <post:ColloList> 
       <post:ColloRow> 
       <post:Weight>5</post:Weight> 
       </post:ColloRow> 
       </post:ColloList> 
<post:CustomDataBit1>false</post:CustomDataBit1> 
<post:DeliveryServiceThirdPartyID>10</post:DeliveryServiceThirdPartyID> 
<post:FeatureList> 
      </post:FeatureList> 
<post:OURecipientAddress> 
    <post:AddressLine1>Teststrasse</post:AddressLine1> 
    <post:AddressLine2/> 
    <post:City>Wien</post:City> 
    <post:CountryID>AT</post:CountryID> 
    <post:Email></post:Email> 
    <post:HouseNumber>1</post:HouseNumber> 
    <post:Name1>Test Recipient</post:Name1> 
    <post:PostalCode>1030</post:PostalCode> 
</post:OURecipientAddress> 
<post:OUShipperAddress> 
    <post:AddressLine1>xxx</post:AddressLine1> 
    <post:City>xxx</post:City> 
    <post:CountryID>AT</post:CountryID> 
    <post:Name1>xxx</post:Name1> 
    <post:Name2></post:Name2> 
    <post:PostalCode>xx</post:PostalCode> 
</post:OUShipperAddress> 
<post:OrgUnitGuid>xxx</post:OrgUnitGuid> 
<post:OrgUnitID>xxx</post:OrgUnitID> 
    <post:PrinterObject> 
      <post:LabelFormatID>100x200</post:LabelFormatID> 
      <post:LanguageID>pdf</post:LanguageID> 
      <post:PaperLayoutID>2xA5inA4</post:PaperLayoutID> 
     </post:PrinterObject> 
     </post:row> 
     </post:ImportShipment> 
    </soapenv:Body> 
</soapenv:Envelope> 

Die Serviceadresse ist: http://plctest.post.at/DataService/Post.Webservice/ShippingService.svc?wsdl

Also habe ich versucht:

$client = new SoapClient('http://plctest.post.at/DataService/Post.Webservice/ShippingService.svc?wsdl'); 
$result = $client->ImportShipment($params); 

Aber ich weiß nicht, wie $ formatiert werden params basiert auf dem XML.

Jede Hilfe wäre großartig. Danke.

+0

wahrscheinlich y sollte nicht einen Link zu Ihrem eigentlichen Dienst in Ihrer Frage – Takarii

+0

Post Der Link ist kein Geheimnis, auch ist es die Sandbox-Version des echten Dienstes. –

+1

Meine IP-Adresse zu Hause ist nicht geheim, aber ich würde es immer noch nicht absichtlich posten – Takarii

Antwort

0
try{ 
     $client  = new SoapClient("http://plctest.post.at/DataService/Post.Webservice/ShippingService.svc?wsdl"); 
     echo "<pre>"; 
     var_dump($client->__getFunctions()); 
     var_dump($client->__getTypes()); 
     echo "</pre>"; 
    }catch(Exception $e){ 
     echo $e->getMessage(); 
    } 

Sie überprüfen Funktionen und Parameter über Code wie dies. So Ausgabe:

 

    array(10) { 
     [0]=> 
     string(65) "ImportShipmentResponse ImportShipment(ImportShipment $parameters)" 
     [1]=> 
     string(98) "ImportShipmentReturnImageResponse ImportShipmentReturnImage(ImportShipmentReturnImage $parameters)" 
     [2]=> 
     string(62) "ImportAddressResponse ImportAddress(ImportAddress $parameters)" 
     [3]=> 
     string(68) "PerformEndOfDayResponse PerformEndOfDay(PerformEndOfDay $parameters)" 
     [4]=> 
     string(68) "CancelShipmentsResponse CancelShipments(CancelShipments $parameters)" 
     [5]=> 
     string(65) "ImportShipmentResponse ImportShipment(ImportShipment $parameters)" 
     [6]=> 
     string(98) "ImportShipmentReturnImageResponse ImportShipmentReturnImage(ImportShipmentReturnImage $parameters)" 
     [7]=> 
     string(62) "ImportAddressResponse ImportAddress(ImportAddress $parameters)" 
     [8]=> 
     string(68) "PerformEndOfDayResponse PerformEndOfDay(PerformEndOfDay $parameters)" 
     [9]=> 
     string(68) "CancelShipmentsResponse CancelShipments(CancelShipments $parameters)" 
    } 
    array(33) { 
     [0]=> 
     string(40) "struct ArrayOfstring { 
    string string; 
    }" 
     [1]=> 
     string(8) "int char" 
     [2]=> 
     string(17) "duration duration" 
     [3]=> 
     string(11) "string guid" 
     [4]=> 
     string(85) "struct ArrayOfShipmentDocumentEntry { 
    ShipmentDocumentEntry ShipmentDocumentEntry; 
    }" 
     [5]=> 
     string(106) "struct ShipmentDocumentEntry { 
    int DocumentID; 
    int ID; 
    string Number; 
    int Quantity; 
    int ShipmentID; 
    }" 
     [6]=> 
     string(41) "struct EntityBase { 
    ID Id; 
    IDREF Ref; 
    }" 
     [7]=> 
     string(43) "struct ImportShipment { 
    ShipmentRow row; 
    }" 
     [8]=> 
     string(781) "struct ShipmentRow { 
    AddressRow AlternativeReturnOrgUnitAddress; 
    ArrayOfstring BusinessDocumentEntryList; 
    int ClientID; 
    ArrayOfColloRow ColloList; 
    string CostCenterThirdPartyID; 
    boolean CustomDataBit1; 
    boolean CustomDataBit2; 
    string CustomsDescription; 
    string DeliveryInstruction; 
    string DeliveryServiceThirdPartyID; 
    ArrayOfAdditionalInformationRow FeatureList; 
    string MovementReferenceNumber; 
    string Number; 
    AddressRow OURecipientAddress; 
    AddressRow OUShipperAddress; 
    string OUShipperReference1; 
    string OUShipperReference2; 
    guid OrgUnitGuid; 
    int OrgUnitID; 
    PrinterRow PrinterObject; 
    int ReturnDays; 
    int ReturnModeID; 
    int ReturnOptionID; 
    ArrayOfShipmentDocumentEntry ShipmentDocumentEntryList; 
    dateTime ShippingDateTimeFrom; 
    dateTime ShippingDateTimeTo; 
    }" 
     [9]=> 
     string(379) "struct AddressRow { 
    string AddressLine1; 
    string AddressLine2; 
    string City; 
    string CountryID; 
    string EORINumber; 
    string Email; 
    string Fax; 
    string Homepage; 
    string HouseNumber; 
    string Name1; 
    string Name2; 
    string Name3; 
    string Name4; 
    string PersonalTaxNumber; 
    string PostalCode; 
    string ProvinceCode; 
    string Tel1; 
    string Tel2; 
    string ThirdPartyID; 
    string VATID; 
    }" 
     [10]=> 
     string(46) "struct ArrayOfColloRow { 
    ColloRow ColloRow; 
    }" 
     [11]=> 
     string(152) "struct ColloRow { 
    ArrayOfColloArticleRow ColloArticleList; 
    ArrayOfColloCodeRow ColloCodeList; 
    int Height; 
    int Length; 
    decimal Weight; 
    int Width; 
    }" 
     [12]=> 
     string(67) "struct ArrayOfColloArticleRow { 
    ColloArticleRow ColloArticleRow; 
    }" 
     [13]=> 
     string(260) "struct ColloArticleRow { 
    string ArticleName; 
    string ArticleNumber; 
    decimal ConsumerUnitNetWeight; 
    string CountryOfOriginID; 
    string CurrencyID; 
    int CustomsOptionID; 
    string HSTariffNumber; 
    decimal Quantity; 
    string UnitID; 
    decimal ValueOfGoodsPerUnit; 
    }" 
     [14]=> 
     string(58) "struct ArrayOfColloCodeRow { 
    ColloCodeRow ColloCodeRow; 
    }" 
     [15]=> 
     string(87) "struct ColloCodeRow { 
    string Code; 
    int NumberTypeID; 
    string OUCarrierThirdPartyID; 
    }" 
     [16]=> 
     string(94) "struct ArrayOfAdditionalInformationRow { 
    AdditionalInformationRow AdditionalInformationRow; 
    }" 
     [17]=> 
     string(121) "struct AdditionalInformationRow { 
    string ThirdPartyID; 
    string Value1; 
    string Value2; 
    string Value3; 
    string Value4; 
    }" 
     [18]=> 
     string(105) "struct PrinterRow { 
    string Encoding; 
    string LabelFormatID; 
    string LanguageID; 
    string PaperLayoutID; 
    }" 
     [19]=> 
     string(179) "struct ImportShipmentResponse { 
    ArrayOfColloRow ImportShipmentResult; 
    string zplLabelData; 
    string pdfData; 
    string shipmentDocuments; 
    string errorCode; 
    string errorMessage; 
    }" 
     [20]=> 
     string(54) "struct ImportShipmentReturnImage { 
    ShipmentRow row; 
    }" 
     [21]=> 
     string(188) "struct ImportShipmentReturnImageResponse { 
    ArrayOfColloRow ImportShipmentReturnImageResult; 
    ArrayOfstring imageData; 
    string shipmentDocuments; 
    string errorCode; 
    string errorMessage; 
    }" 
     [22]=> 
     string(104) "struct ImportAddress { 
    int clientID; 
    int orgUnitID; 
    guid orgUnitGuid; 
    ArrayOfAddressRow addresses; 
    }" 
     [23]=> 
     string(52) "struct ArrayOfAddressRow { 
    AddressRow AddressRow; 
    }" 
     [24]=> 
     string(73) "struct ImportAddressResponse { 
    string errorCode; 
    string errorMessage; 
    }" 
     [25]=> 
     string(76) "struct PerformEndOfDay { 
    int clientID; 
    int orgUnitID; 
    guid orgUnitGuid; 
    }" 
     [26]=> 
     string(106) "struct PerformEndOfDayResponse { 
    string PerformEndOfDayResult; 
    string errorCode; 
    string errorMessage; 
    }" 
     [27]=> 
     string(63) "struct CancelShipments { 
    ArrayOfCancelShipmentRow shipments; 
    }" 
     [28]=> 
     string(73) "struct ArrayOfCancelShipmentRow { 
    CancelShipmentRow CancelShipmentRow; 
    }" 
     [29]=> 
     string(124) "struct CancelShipmentRow { 
    int ClientID; 
    ArrayOfstring ColloCodeList; 
    string Number; 
    guid OrgUnitGuid; 
    int OrgUnitID; 
    }" 
     [30]=> 
     string(86) "struct CancelShipmentsResponse { 
    ArrayOfCancelShipmentResult CancelShipmentsResult; 
    }" 
     [31]=> 
     string(82) "struct ArrayOfCancelShipmentResult { 
    CancelShipmentResult CancelShipmentResult; 
    }" 
     [32]=> 
     string(115) "struct CancelShipmentResult { 
    boolean CancelSuccessful; 
    string ErrorCode; 
    string ErrorMessage; 
    string Number; 
    }" 
    } 

Finden Sie Ihre Funktion und ihre Parameter und die Funktion aufrufen mit __soapCall

Edit:

Sie die Paramater dieser Web-Service der Funktion aufrufen singleWsdl Sie zeigen es:

http://plctest.post.at/DataService/Post.Webservice/ShippingService.svc?singleWsdl

+0

Ok danke das half ein wenig. Ich sehe die Funktion zum Erstellen einer neuen Sendung ist "ImportShipment", aber es gibt mehrere Parameter, die hinzugefügt werden müssen, und ich bin nicht in der Lage, ein funktionierendes Beispiel aus __getTypes zu erarbeiten. –

+0

$ result = $ client -> __ soapCall ("ImportShipment", array ('parameter' => $ params)); mit meinem Versuch für $ params, ruft mir dies: Objekt (StdClass) # 126 (6) {["ImportShipmentResult"] => NULL ["zplLabelData"] => NULL ["pdfData"] => NULL [" sendingDocuments "] => NULL [" errorCode "] => Zeichenkette (9)" SN # 100016 "[" errorMessage "] => Zeichenkette (73)" –

+0

"wurde gesendet es! Danke. –