Færdiggjort

Convert a php / c# code into python

Need a convert a function into python that is developed in php / c#...

Need to convert the following php code:

<?php

// Klasa obiektu autoryzacyjnego

class AuthDataV1
{
public $login;
public $masterFid;
public $password;
};

$authData = new AuthDataV1();
$authData->login="pmarat";
$authData->masterFid="1495";
$authData->password="pm14";


// Klient webservice

$client = new
SoapClient("http://apps00dev.biz:9090/DPDPackageXmlServicesService/DPDPackageXmlServices?wsdl"
,array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));

// Dane awizacyjne

$openUMLFV1="
<Packages>
<Package>
<PayerType>SENDER</PayerType>
<Sender>
<FID>1495</FID>
<Company>DPD Polska Sp. z o.o.</Company>
<Name>Jan Kowalski</Name>
<Address>Ul. Mineralna 15</Address>
<City>Warszawa</City>
<CountryCode>PL</CountryCode>
<PostalCode>02274</PostalCode>
<Phone>022 577 55 003</Phone>
<Email>dpd@dpd.com.pl</Email>
</Sender>
<Receiver>
<Company>Oddział Regionalny w Katowicach</Company>
<Name>Jan Malinowski</Name>
<Address>ul. Brzezińska 59</Address>
<City>Mysłowice</City>
<CountryCode>PL</CountryCode>
<PostalCode>41404</PostalCode>
<Phone>32 202-40-11</Phone>
<Email>ktos@pocztowy.pl</Email>
</Receiver>
<Reference>REF987654321</Reference>
<Ref1>1234567890</Ref1>
<Ref2>abcdefgh</Ref2>
<Ref3>ZZZZZZZZZ</Ref3>
<Services>
<COD>
<Amount>1234</Amount>
<Currency>PLN</Currency>
</COD>
</Services>
<Parcels>
<Parcel>
<Weight>12.20</Weight>
<Content>telefon</Content>
<CustomerData1>dane1</CustomerData1>
</Parcel>
<Parcel>
<Weight>120.00</Weight>
<Content>dokumentacja</Content>
<CustomerData1>dane2</CustomerData1>
</Parcel>
</Parcels>
</Package>
</Packages>
";

// walidacja danych przesyłek i nadawanie numerów listów przewozowych
$params1->pkgNumsGenerationPolicyV1 ="IGNORE_ERRORS";
$params1->openUMLXV1= $openUMLFV1;
$params1->authDataV1 = $authData;

$result = $client->generatePackagesNumbersXV1( $params1 );

$xml = simplexml_load_string($result->return);

//
$sessionId = $xml->SessionId;
$packageId = $xml->Packages->Package[0]->PackageId;
$parcelId = $xml->Packages->Package[0]->Parcels->Parcel[1]->ParcelId;
$waybill = $xml->Packages->Package[0]->Parcels->Parcel[1]->Waybill;
$reference = $xml->Packages->Package[0]->Reference;
$FID = 1495; // global

//
$dpdServiceParam1 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<Session>
<SessionType>DOMESTIC</SessionType>
<SessionId>"
. $sessionId .
"</SessionId>
</Session>
</DPDServicesParamsV1>
";

$params2->dpdServicesParamsXV1 = $dpdServiceParam1;
$params2->outputDocFormatV1 = "PDF";
$params2->outputDocPageFormatV1="A4";
$params2->authDataV1 = $authData;
$result = $client->generateSpedLabelsXV1( $params2 );
$xml = simplexml_load_string($result->return);
$pdf1 = $xml->DocumentData;
echo $xml->Session->StatusInfo->Status;


// by packageId
$dpdServiceParam2 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<PackageId>"
. $packageId .
"</PackageId>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>";

$params3->dpdServicesParamsXV1 = $dpdServiceParam2;
$params3->outputDocFormatV1 = "PDF";
$params3->outputDocPageFormatV1="A4";
$params3->authDataV1 = $authData;
$result = $client->generateSpedLabelsXV1( $params3 );
$xml = simplexml_load_string($result->return);
$pdf2 = $xml->DocumentData;
echo $xml->Session->StatusInfo->Status;

// by ref.
$dpdServiceParam3 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Reference>"
. $reference .
"</Reference>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params4->dpdServicesParamsXV1 = $dpdServiceParam3;
$params4->outputDocFormatV1 = "PDF";
$params4->outputDocPageFormatV1="A4";
$params4->authDataV1 = $authData;
$result = $client->generateSpedLabelsXV1( $params4 );
$xml = simplexml_load_string($result->return);
$pdf3 = $xml->DocumentData;
echo $xml->Session->StatusInfo->Status;

// by parcelId
$dpdServiceParam4 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Parcels>
<Parcel>
<ParcelId>"
. $parcelId .
"</ParcelId>
</Parcel>
</Parcels>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params5->dpdServicesParamsXV1 = $dpdServiceParam4;
$params5->outputDocFormatV1 = "PDF";
$params5->outputDocPageFormatV1="A4";
$params5->authDataV1 = $authData;
$result = $client->generateSpedLabelsXV1( $params5 );
$xml = simplexml_load_string($result->return);
$pdf4 = $xml->DocumentData;
echo $xml->Session->StatusInfo->Status;

// Tworzenie etykiet na podstawie waybill
$dpdServiceParam5 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Parcels>
<Parcel>
<Waybill>"
. $waybill .
"</Waybill>
</Parcel>
</Parcels>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params6->dpdServicesParamsXV1 = $dpdServiceParam5;
$params6->outputDocFormatV1 = "PDF";
$params6->outputDocPageFormatV1="A4";
$params6->authDataV1 = $authData;
$result = $client->generateSpedLabelsXV1( $params6 );
$xml = simplexml_load_string($result->return);
$pdf5 = $xml->DocumentData;
echo $xml->Session->StatusInfo->Status . "<br/>";

// protokoły

$protocolIdTable = array();

// Tworzenie protokołów na podstawie sessionId

$dpdServiceParam6 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<PickupAddress>
<FID>" . $FID . "</FID>
</PickupAddress>
<Session>
<SessionType>DOMESTIC</SessionType>
<SessionId>" . $sessionId . "</SessionId>
</Session>
</DPDServicesParamsV1>
";
$params7->dpdServicesParamsCV1 = $dpdServiceParam6;
$params7->outputDocFormatV1 = "PDF";
$params7->outputDocPageFormatV1="A4";
$params7->authDataV1 = $authData;
$result = $client->generateProtocolXV1( $params7 );
$xml = simplexml_load_string($result->return);
$pdf6 = $xml->DocumentData;
$protocolIdTable[0] = $xml->DocumentId;
echo $xml->Session->StatusInfo->Status;

// Tworzenie protokołów na podstawie waybill
$dpdServiceParam7 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<PickupAddress>
<FID>" . $FID . "</FID>
</PickupAddress>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Parcels>
<Parcel>
<Waybill>"
. $waybill .
"</Waybill>
</Parcel>
</Parcels>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params8->dpdServicesParamsCV1 = $dpdServiceParam7;
$params8->outputDocFormatV1 = "PDF";
$params8->outputDocPageFormatV1="A4";
$params8->authDataV1 = $authData;
$result = $client->generateProtocolXV1( $params8);
$xml = simplexml_load_string($result->return);
$pdf7 = $xml->DocumentData;
$protocolIdTable[1] = $xml->DocumentId;
echo $xml->Session->StatusInfo->Status;

// by parcelId
$dpdServiceParam8 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<PickupAddress>
<FID>" . $FID . "</FID>
</PickupAddress>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Parcels>
<Parcel>
<ParcelId>"
. $parcelId .
"</ParcelId>
</Parcel>
</Parcels>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params9->dpdServicesParamsCV1 = $dpdServiceParam8;
$params9->outputDocFormatV1 = "PDF";
$params9->outputDocPageFormatV1="A4";
$params9->authDataV1 = $authData;
$result = $client->generateProtocolXV1( $params9);
$xml = simplexml_load_string($result->return);
$pdf8= $xml->DocumentData;
$protocolIdTable[2] = $xml->DocumentId;
echo $xml->Session->StatusInfo->Status;

// Tworzenie protokołów na podstawie packageId
$dpdServiceParam9 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<PickupAddress>
<FID>" . $FID . "</FID>
</PickupAddress>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<PackageId>"
. $packageId .
"</PackageId>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params10->dpdServicesParamsCV1 = $dpdServiceParam9;
$params10->outputDocFormatV1 = "PDF";
$params10->outputDocPageFormatV1="A4";
$params10->authDataV1 = $authData;
$result = $client->generateProtocolXV1( $params10);
$xml = simplexml_load_string($result->return);
$pdf9 = $xml->DocumentData;
$protocolIdTable[3] = $xml->DocumentId;
echo $xml->Session->StatusInfo->Status;

// Tworzenie protokołów na podstawie package ref

$dpdServiceParam10 =
"<DPDServicesParamsV1>
<Policy>STOP_ON_FIRST_ERROR</Policy>
<PickupAddress>
<FID>" . $FID . "</FID>
</PickupAddress>
<Session>
<SessionType>DOMESTIC</SessionType>
<Packages>
<Package>
<Reference>"
. $reference .
"</Reference>
</Package>
</Packages>
</Session>
</DPDServicesParamsV1>
";
$params11->dpdServicesParamsCV1 = $dpdServiceParam10;
$params11->outputDocFormatV1 = "PDF";
$params11->outputDocPageFormatV1="A4";
$params11->authDataV1 = $authData;
$result = $client->generateProtocolXV1( $params11);
$xml = simplexml_load_string($result->return);
$pdf10 = $xml->DocumentData;
$protocolIdTable[4] = $xml->DocumentId;
echo $xml->Session->StatusInfo->Status;
// Zamawianie kuriera
echo "<br/>zamawianie kuriera<br/>";
$pickupDate = "2012-02-08";
$pickupTimeFrom = "13:00";
$pickupTimeTo = "15:00";

$dpdServiceParam11 =
"<DPDPickupCallParamsV2>
<OperationType>INSERT</OperationType>
<PickupDate>" . $pickupDate . "</PickupDate>
<PickupTimeFrom>" . $pickupTimeFrom . "</PickupTimeFrom>
<PickupTimeTo>" . $pickupTimeTo . "</PickupTimeTo>
<OrderType>DOMESTIC</OrderType>
<WaybillsReady>true</WaybillsReady>
<PickupCallSimplifiedDetails>
<PickupPayer>
<PayerNumber>57888</PayerNumber>
<PayerName>wrewerwerwer</PayerName>
<PayerCostCenter>werwerwerwee</PayerCostCenter>
</PickupPayer>
<PickupCustomer>
<CustomerName>customerName</CustomerName>
<CustomerFullName>customerFullName</CustomerFullName>
<CustomerPhone>111222333</CustomerPhone>
</PickupCustomer>
<PickupSender>
<SenderName>23049094u 2309u4 2309u4 </SenderName>
<SenderFullName>Jan Kowalski</SenderFullName>
<SenderAddress>ul. Złota 12/2</SenderAddress>
<SenderCity>Gdańsk</SenderCity>
<!--SenderPostalCode>02495</SenderPostalCode-->
<SenderPostalCode>02274</SenderPostalCode>
<SenderPhone>111222333</SenderPhone>
</PickupSender>
<PackagesParams>
<DOX>false</DOX>
<StandardParcel>true</StandardParcel>
<Pallet>false</Pallet>
<ParcelsCount>3</ParcelsCount>
<PalletsCount>5</PalletsCount>
<DOXCount>11</DOXCount>
<ParcelsWeight>10004.2</ParcelsWeight>
<ParcelMaxWeight>10.2</ParcelMaxWeight>
<ParcelMaxWidth>20.2</ParcelMaxWidth>
<ParcelMaxHeight>19.2</ParcelMaxHeight>
<ParcelMaxDepth>21</ParcelMaxDepth>
<PalletsWeight>15.2</PalletsWeight>
<PalletMaxWeight>15.2</PalletMaxWeight>
<PalletMaxHeight>15.2</PalletMaxHeight>
</PackagesParams>
</PickupCallSimplifiedDetails>
</DPDPickupCallParamsV2>
";

$params12->dpdPickupParamsXV2 = $dpdServiceParam11;
$params12->authDataV1 = $authData;
$result = $client->packagesPickupCallXV2($params12);
$xml = simplexml_load_string($result->return);
echo "<BR/>status zamówienia: " . $xml->StatusInfo->Status . "<BR/>";
if( strcmp($xml->StatusInfo->Status, "OK") == 0)
{
echo "<BR/>numer zamówienia kuriera: " . $xml->OrderNumber . "<BR/>";
}
else
{
$code = $xml->StatusInfo->ErrorDetails->Error->Code;
$description = $xml->StatusInfo->Description;
$fields = $xml->StatusInfo->ErrorDetails->Error->Fields;
echo "<BR/>kod błędu: " . $code . ", opis błędu: " . $description . ", lista
błędnych pól: " . $fields . "<BR/>";
}

?>

Evner: PHP, Python

Se mere: convert python, php c#, convert php, Convert a, c++ code, c code, python function, python code convert, python convert php, code convert python, convert python code, python code php code, python code convert code, python convert, convert code python, php function convert php, convert php function python, code convert php, convert php function, convert code php code

Om arbejdsgiveren:
( 2 bedømmelser ) Dhaka, Bangladesh

Projekt ID: #5483559

Tildelt til:

smellyfinger

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea comm Flere

$30 USD på 1 dag
(1 bedømmelse)
2.2

2 freelancere byder i gennemsnit $36 timen for dette job

r4huln4ir

A proposal has not yet been provided

$42 USD på 1 dag
(0 bedømmelser)
0.0