Handling DIME Attachments. Probably error?
| From: | aaa | Date: | Thu, 22 May 2003 18:20:55 +0000 |
| Subject: | Handling DIME Attachments. Probably error? | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-641@lists.php.net to get a copy of this message | ||
Hello, I'm tryimg to send DIME attachment from MS SOAP Toolkit client to
PEAR:SOAP server. It doesn't work as it is. I'll try to describe why.
After _decodeDIMEMessage the $attachments array has 2 entries:
cid:uuid:714C6C40-4531-442E-A498-3AC614200295 => <?xml
version="1.0" .....<SOAP-ENV:Envelope .... > <someFile
href="uuid:76A59191-333A-4455-AD15-AE4F0F9C64CF"/> .....
</SOAP-ENV:Envelope>
cid:uuid:76A59191-333A-4455-AD15-AE4F0F9C64CF =>
[contenst_of_someFile]
When parsing SOAP request, in Parser.php there are lines:
} elseif ($kqn->name == 'href') {
...
} else if (isset($this->attachments[$value])) {
$this->message[$pos]['cdata'] =
$this->attachments[$value];
They are supposed to link attachment to variable. But they do not, because
$value contains "uuid:76A5..." as stated in href property of "someFile" tag
but $attachments array conatins key of "cid:uuid:76A59....". An extra of
"cid:" characters. For me the following fix works fine:
} else if (isset($this->attachments[$value])) {
$this->message[$pos]['cdata'] =
$this->attachments[$value];
}else if (isset($this->attachments["cid:".$value])) {
$this->message[$pos]['cdata'] =
$this->attachments["cid:".$value];
}
May be developers should fix this somehow...
PS. To send request I used this VB code:
Set soapClient3 = CreateObject("MSSOAP.SoapClient30")
Call soapClient3.MSSoapInit("collectionsP.WSDL")
Set FileAttachIn = CreateObject("MSSOAP.FileAttachment30")
FileAttachIn.FileName = FileName
soapClient3.SetData FileAttachIn
and this wsdl:
<?xml version="1.0"?><definitions name="ServerExample"
targetNamespace="urn:ServerExample"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:ServerExample"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:dime='http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/'
xmlns:ns5="http://soapinterop.org/xsd">
<types xmlns="http://schemas.xmlsoap.org/wsdl/">
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://soapinterop.org/xsd">
<complexType name='UnknownBinaryContent'>
<simpleContent><restriction
base='base64Binary'><annotation><appinfo/></annotation></restriction></simpl
eContent></complexType>
</schema>
</types>
<portType name="ServerExamplePort">
<operation name="SetData">
<input message="tns:SetDataRequest" />
<output message="tns:SetDataResponse" />
</operation>
</portType>
<binding name="ServerExampleBinding" type="tns:ServerExamplePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http/"
/>
<operation name="SetData">
<soap:operation
soapAction="urn:SOAP_Example_Server#soap_example_server#SetData" />
<input>
<dime:message
layout='http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout'
wsdl:required='true'/>
<soap:body use="encoded" namespace="urn:SOAP_Example_Server"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
</input>
<output>
<soap:body use="encoded" namespace="urn:SOAP_Example_Server"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
</output>
</operation>
</binding>
<service name="ServerExampleService">
<documentation />
<port name="ServerExamplePort" binding="tns:ServerExampleBinding">
<soap:address location="http://somewhere" />
</port>
</service>
<message name="SetDataRequest">
<part name="someFile" type="ns5:UnknownBinaryContent"/>
</message>
<message name="SetDataResponse" />
</definitions>