如何將圖像從移動Web應用程序發送到現有Web服務。我考慮過使用PhoneGap FileTransfer對象,但我不知道如何將這個調用包裝在一個SOAP數據包中。如何將圖像從移動Web應用程序(PhoneGap和JavaScript)上傳到SOAP Web服務
我需要上傳圖片的服務器,希望圖像包裝在一個SOAP數據包中。從下面的服務描述中,可以看到服務器期望base64Binary中的文件。有沒有人做過這樣的事情之前,還是我的第一個(或最後一個)水牛過河(被鱷魚吃掉):
POST /Service.asmx HTTP/1.1
Host: 127.0.0.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<AuthHeader xmlns="http://localhost/">
<LogonID>string</LogonID>
<Password>string</Password>
</AuthHeader>
</soap12:Header>
<soap12:Body>
<uploadFile xmlns="http://localhost/">
<FileDetails>
<ReferenceNumber>string</ReferenceNumber>
<FileName>string</FileName>
<FileType>int</FileType>
<FileContents>base64Binary</FileContents>
</FileDetails>
</uploadFile>
</soap12:Body>
</soap12:Envelope>
這真的是一個很好的答案,你有沒有嘗試發送一個SOAP請求與JavaScript使用mtom附件? – ye9ane 2013-01-08 12:03:47