PHP How do I send an XML to a SOAP service?

0

I have a question, I need to send this XML format to a SOAP service to get an answer, but I do not know how to add those headers

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.sunat.gob.pe" xmlns:wsse="http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <soapenv:Header>
      <wsse:Security>
         <wsse:UsernameToken>
            <wsse:Username>20100066603MODDATOS</wsse:Username>
            <wsse:Password>moddatos</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ser:sendSummary>
         <fileName>20100066603-RC-20110522-1.zip</fileName>
         <contentFile>cid:20100066603-RC-20110522-1.zip</contentFile>
      </ser:sendSummary>
   </soapenv:Body>
</soapenv:Envelope>

I was looking for and I saw the function DomDocument of the PHP manual to generate XML but I can not send it . Also try SOAPClient but it is not clear to me how to add the headers.

    
asked by Ricardo Vera Nervi 19.12.2017 в 16:46
source

1 answer

0

If the XML that you show in the "template" that would have the request that you would be sending, you could use that same simply by replacing the values of the parameters and using:

But if you want to build the XML then start by researching how to build XML here I have something very, very basic about XML in C #:

answered by 20.08.2018 в 02:24