PHP SoapClient upload file

  php, soap

How can I upload a file with SoapClient?

PHP Code:

$WSEDC = new SoapClient('http://172.32.132.2/CareWSCHISS/WSEDC.asmx?WSDL');
        $response = $WSEDC->EDCDataCheckIn([
            'EDCData' => [
                // Class
                'BenefitID' => '',
                'BilledAmount' => '',
                'ApprovedAmount' => '',
                'ExcessAmount' => '',
                'CashMember' => '',
                'Quantity' => '',
                'CReason' => '',
                // End Class
                'BenefitLimit' => '',
                'ClaimNo' => '',
                'PolicyNo' => '',
                'TransmissionDate' => now()->format('Y-m-d'),
                'ProcessingDate' => now()->format('Y-m-d'),
                'ProcessingTime' => now()->format('H:i'),
                'ResponseCode' => '',
                'TID' => $data['provider_id'],
                'MID' => '',
                'CardNo' => $data['card_no'],
                'TraceNumber' => '',
                'DiagnosticNo' => '00',
                'DiagnosticNo1' => '',
                'DiagnosticNo2' => '',
                'Remarks' => $data['remarks'],
                'TotalBilled' => $data['total_claim_amount'],
                'ClaimDocument' => '',
                'FileName' => '', // file name
                'TmpFile' => '', // file
                'DocumentID' => '',
                'MIME' => '', // file mime
                'ErrorMessage' => '',
                'ClaimType' => $data['coverage'],
                'ReimbursementF' => 1,
                'Start' => $data['admission_date_from'],
                'Finish' => $data['admission_date_to'],
                'OverallLimitAmount' => 0,
                'RemainingLimit' => 0,
                'BilledAmountTotal' => 0,
                'ApprovedAmountTotal' => 0,
                'ExcessAmountTotal' => 0,
                'CashMemberTotal' => 0,
                'ExcessPayOnSpotF' => 0,
            ],
            'EDCMemberData' => [
                'Name' => '',
                'Sex' => '',
                'MaritalStatus' => '',
                'BirthDate' => '',
                'Address' => '',
                'MemberClass' => '',
                'MemberStatus' => '',
                'StartDate' => '',
                'EndDate' => '',
            ],
            'ErrMsg' => '',
        ]);

        return $response;

I dont know to attach image to TmpFile.
I’ve tried with SoapUI and success. with SoapUi I only need point out the file path

here success feedback from soapui

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <EDCDataCheckInResponse xmlns="http://tempuri.org/">
         <EDCDataCheckInResult>true</EDCDataCheckInResult>
         <EDCData>
            <BenefitID>
               <BenefitIDClass>
                  <BenefitID>1</BenefitID>
               </BenefitIDClass>
            </BenefitID>
            <BilledAmount>
               <BilledAmountClass>
                  <BilledAmount>0</BilledAmount>
               </BilledAmountClass>
            </BilledAmount>
            <ApprovedAmount>
               <ApprovedAmountClass>
                  <ApprovedAmount>0</ApprovedAmount>
               </ApprovedAmountClass>
            </ApprovedAmount>
            <ExcessAmount>
               <ExcessAmountClass>
                  <ExcessAmount>0</ExcessAmount>
               </ExcessAmountClass>
            </ExcessAmount>
            <CashMember>
               <CashMemberClass>
                  <CashMember>0</CashMember>
               </CashMemberClass>
            </CashMember>
            <Quantity>
               <QuantityClass>
                  <Quantity>1</Quantity>
               </QuantityClass>
            </Quantity>
            <CReason>
               <ReasonClass>
                  <CReason>?</CReason>
               </ReasonClass>
            </CReason>
            <BenefitLimit/>
            <ClaimNo>2201010893</ClaimNo>
            <PolicyNo>M00113041900085</PolicyNo>
            <TransmissionDate>2021-11-30T00:00:00</TransmissionDate>
            <ProcessingDate>2021-11-30T00:00:00</ProcessingDate>
            <ProcessingTime>10:29</ProcessingTime>
            <ResponseCode>00</ResponseCode>
            <TID>58</TID>
            <MID/>
            <CardNo>3</CardNo>
            <TraceNumber>?</TraceNumber>
            <DiagnosticNo>00</DiagnosticNo>
            <DiagnosticNo1/>
            <DiagnosticNo2/>
            <Remarks>PT. International </Remarks>
            <TotalBilled>100000</TotalBilled>
            <ClaimDocument>?</ClaimDocument>
            <FileName>Foto</FileName>
            <TmpFile>D:MailboxDetail.png</TmpFile>
            <DocumentID>D001</DocumentID>
            <MIME>image/png</MIME>
            <ErrorMessage>Process Success</ErrorMessage>
            <ClaimType>GL</ClaimType>
            <ReimbursementF>true</ReimbursementF>
            <Start>2022-01-9</Start>
            <Finish>1/9/2022</Finish>
            <OverallLimitAmount>2000000</OverallLimitAmount>
            <RemainingLimit>2000000</RemainingLimit>
            <BilledAmountTotal>0</BilledAmountTotal>
            <ApprovedAmountTotal>0</ApprovedAmountTotal>
            <ExcessAmountTotal>0</ExcessAmountTotal>
            <CashMemberTotal>0</CashMemberTotal>
            <ExcessPayOnSpotF>false</ExcessPayOnSpotF>
         </EDCData>
         <EDCMemberData>
            <Name>JESSTY</Name>
            <Sex>F</Sex>
            <MaritalStatus>M</MaritalStatus>
            <BirthDate>85/03/28</BirthDate>
            <Address/>
            <MemberClass>Class 6</MemberClass>
            <MemberStatus>Active</MemberStatus>
            <StartDate>21/09/01</StartDate>
            <EndDate>22/08/31</EndDate>
         </EDCMemberData>
         <ErrMsg/>
      </EDCDataCheckInResponse>
   </soap:Body>
</soap:Envelope>

Source: Ask PHP

LEAVE A COMMENT