SOAP and ATTACHMENT
| From: | Henning Reich | Date: | Mon, 14 Jul 2003 13:21:11 +0000 |
| Subject: | SOAP and ATTACHMENT | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-787@lists.php.net to get a copy of this message | ||
Hi,
I'm running PEAR::SOAP 0.7.5, PHP 4.3.2RC4, Apache 1.3.27, on a Windows 2000
platform.
The problem is that SOAP Messages with Attachments (Mime) doesnt work. There
is no internal error from PEAR:SOAP but i guess PEAR:SOAP generates the
attachment part wrong! So that it is not WC3 conform and my endpoint the
SOAP server isnt able to parse the message. Here is what i want to do (the
qad source-code):
############################################################################
#########################
Thats the PHP script....
<?php
require_once('SOAP/Client.php');
$endpoint = "http://myip:6023/servlet/my.net.SOAPService";
$filename = "file.zip";
$attachment = new
SOAP_Attachment("test_attachment","application/octet-stream",$filename);
$methodValue = new SOAP_Value("testattach","Struc",array($attachment));
$soapclient = new SOAP_Client($endpoint);
$method = "test_soap";
//attachment alone
//$params = array($attachment);
//or if i dont want only the attachment, but same additional parameters with
it
$params =
array("p_one"=>1,"p_two"=>2,"file_attach"=>$attachment);
//i dont use the CALL function because i want to get the generatet SOAP-Code
(Message)
//i dont know if there is an other way to get the PEAR::SOAP generated SOAP
message???????
$request = $soapclient->__generate($method, $params, $options);
echo $request;
?>
Thats the SOAP msg ($request, it is in UTF-8)....
�����)��phttp://schemas.xmlsoap.org/soap/envelope/�&
#0;�<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="http://soapinterop.org/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:test_soap>
<p_one xsi:type="xsd:int">1</p_one>
<p_two xsi:type="xsd:int">2</p_two>
<test_attachment
href="cid:7793f13204bb2e5e6c98e05163e3ccd6"/></ns4:test_soap>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
���
����7793f13204bb2e5e6c98e05163e3ccd6application/octet-streamPK
����O1µ&Ý{i«*��@�����scrolling_menu.h
tm.Ñn>0?ï'í <OªR)"HjiëÚ-]Ó«i÷9
.......more binary code.........
��
��������
�¶Z��readme.htmlPK�����e³´&ÃsÎ���&
#0;���������
�¶X��menu.jpgPK�����¹0µ&ÓYëòi���½�&
#0;� �������� �¶~
��style.cssPK�����[°´&û¡ûßÿ��>��
��������
�¶(-��common.jsPK������
��N
������������������
@����������
############################################################################
###
Do you have any suggestions how to solve this problem or how i can send SOAP
messages with attachmens using PHP and PEAR::SOAP???
Please drop one or to lines to help me out,
Thanks fellows,
cu Henning.