Это код, который я пытаюсь:
$body= $body = '<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b</a:Action>
<a:From>
<a:Address>urn:oid:2.16.840.1.113883.3.1259.10.1003</a:Address>
</a:From>
<a:To>https://CDACert.hawaiihie.org:20000/repository</a:To>
</s:Header>
<s:Body>
<ProvideAndRegisterDocumentSetRequest xmlns="urn:ihe:iti:xds-b:2007" xmlns:xop="http://www.w3.org/2004/08/xop/include">
<lcm3:SubmitObjectsRequest xmlns:lcm3="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0" xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
<rim:RegistryObjectList>
<rim:ExtrinsicObject id="Document1" mimeType="text/xml" objectType="urn:uuid:7edca82f-054d-47f2-a032-9b2a5b5186c1">
</rim:Association>
</rim:RegistryObjectList>
</lcm3:SubmitObjectsRequest>
<Document id=\"Document1\">
<xop:Include href="cid:test_ID_123"
xmlns:xop="http://www.w3.org/2004/08/xop/include"/></Document>
</ProvideAndRegisterDocumentSetRequest>
</s:Body>
';
$text = 'dGhpcyBpcyBTaGl2J3MgZG9j';// base64 of content
$boundary = 'MIMEBoundaryurn_uuid_'.uniqid();
$postData = "--$boundary\n"
."Content-Type: application/xop+xml; charset=UTF-8; type=\"application/soap+xml\n"
."Content-Transfer-Encoding: binary\n"
."Content-length:".strlen($body)."\n"
."Content-ID:test_start\n"
.$body."\n\n"
."--$boundary\n"
."Content-Type: text/plain;\n"
."Content-Transfer-Encoding: binary\n"
."Content-length:".strlen($text)."\n"
."Content-ID:test_ID_123\n"
.$text."\n"
."--$boundary--";
$header1 = array (
"Content-Type: multipart/related; type=\"application/xop+xml\"; start=\"test_start\"; start-info=\"application/soap+xml\"; action=\"urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b\"",
"Content-length:".strlen($postData),
"Transfer-Encoding:chunked",
"User-Agent:" .$_SERVER ['HTTP_USER_AGENT'],
"Host:" .$_SERVER['HTTP_HOST']
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $soapUrl);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLINFO_, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array($postData)); // the SOAP request
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch); // 400 HTTP error from curl_info