如何傳送帶有 MTOM 附件的 HTTP Post 請求?

如何傳送帶有 MTOM 附件的 HTTP Post 請求?

如何使用 MTOM 附件傳送 HTTP Post 請求Chrome 的郵差

這是我要發送的內容:

POST https://ws.conf.ebs.health.gov.on.ca:1441/EDTService/EDTService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="application/xop+xml"; start="<[email protected]>"; start-info="text/xml"; boundary="----=_Part_6_26603773.1382366041821"
SOAPAction: ""
MIME-Version: 1.0
Content-Length: 25255
Host: 
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


------=_Part_6_26603773.1382366041821
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID: <[email protected]>

<soapenv:Envelope xmlns:ebs="http://ebs.health.ontario.ca/" xmlns:edt="http://edt.health.ontario.ca/" xmlns:idp="http://idp.ebs.health.ontario.ca/" xmlns:msa="http://msa.ebs.health.ontario.ca/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">   <soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-351EB9B7D1702B24F2138236604178519">MIIF0zCCBLugAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBzzELMAkGA1UEBhMCQ0ExCzAJBgNVBAgTAm9uMREwDwYDVQQHEwhraW5nc3RvbjEpMCcGA1UEChMgSGVhbHRoIFNvbHV0aW9ucyBEZWxpdmVyeSBCcmFuY2gxJTAjBgNVBAsTHEVsZWN0cm9uaWMgQnVz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vbjEpMCcGA1UEChMgSGVhbHRoIFNvbHV0aW9ucyBEZWxpdmVyeSBCcmFuY2gxJTAjBgNVBAsTHEVsZWN0cm9uaWMgQnVzaW5lc3MgU2VydmljZXMxJzAlBgNVBAMTHkVCUyBUZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTElMCMGCSqGSIb3DQEJARYWc2Vhbi5jYXJzb25Ab250YXJpby5jYYIJAOnNHCT34+b/MCEGA1UdEgQaMBiBFnNlYW4uY2Fyc29uQG9udGFyaW8uY2EwJgYDVR0RBB8wHYEbZGVyZXlrLmZlcm5hbmRlc0BvbnRhcmlvLmNhMA4GA1UdDwEB/wQEAwIFoDANBgkqhkiG9w0BAQUFAAOCAQEAJqCht181F8rUUNQ8jHa42kdKH+FDF0ISuklbg5MARHo+wt1laltaMeaXdESnLJBNGvcgxPZ4StYMdCH8mOEWYftCy5nkyGQCuOd2GpaJ3Hj50bjZ9vZUYyUBPUmwIEP2v75QQe62fHTqza/VjA0I5eMGMKa3URHsTdfNdnEJjtmHdxWRjAjjrHpHQWE0e1QtG+ZV1ved0f5OzDvdylbvrm4S0mgCifk8qEvZtNSoDp37MmSFr5fFmo91BqT23xAgzUKra428dw4T1EKJYEd6pNssNS4XCQ6bTx0Au3mW5iINtiaYQP8rlSykwaJ+dFAtBG00kdGpebf1prvq4H91eA==</wsse:BinarySecurityToken><ds:Signature Id="SIG-42" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ebs edt idp msa soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI="#TS-37"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="wsse ebs edt idp msa soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>R9mOEo5O6cDkUYLCdDcmhho5+TflE3Vhzh5djZ9xwFw=</ds:DigestValue></ds:Reference><ds:Reference URI="#UsernameToken-38"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ebs edt idp msa soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>4nQzTZa2lOwytyL6iETEAdTih5Njuafk4vl/zciDU1o=</ds:DigestValue></ds:Reference><ds:Reference URI="#id-39"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="edt idp msa soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>lT8wjzgGpp383r47HQtZHIl8tc7NGb8lk7BBTPNLKEw=</ds:DigestValue></ds:Reference><ds:Reference URI="#id-40"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ebs edt msa soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>ED9cJgORoYXMlyjRIqWwM8XQ+WVg/KN/So03Q2Oiex0=</ds:DigestValue></ds:Reference><ds:Reference URI="#id-41"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ebs edt idp msa" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>4ahPF/Njc0JaaZIbJ2HnNBN0yjxpVVx6RlpJwF4ebk4=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>Ami5BcQwM7uRrUA7fKXqd0RWibJsJqRz7o8vHY1VEVv3GWh9Un+iSIE+rIYxF/omkYyRnM279mHn
5vEqtFB8Q2XuJAvi0f/tNuswO1hdvej/DgOEQfucRuPFspSt3GAVzxgo10vKkEnPnQte8S+3EgAv
g0s+qttjb5UNH8LtpF3xwpl3fqSvPbv628aJXmcXiLxzcwaYo2pq2NFqioHxJB2G0nbF23Lo89Jr
6l70x04G0tVvOv3tooHXfuMw+8p41daN+PrlPTd/cjV81hQ+cD6HtSqmiMkk0pdyCxDBc8QFFDgK
0jOLxJgZKzbofgnUUKsjt6n3GTWy+9aLK3NAdQ==</ds:SignatureValue><ds:KeyInfo Id="KI-351EB9B7D1702B24F2138236604178520"><wsse:SecurityTokenReference wsu:Id="STR-351EB9B7D1702B24F2138236604178521"><wsse:Reference URI="#X509-351EB9B7D1702B24F2138236604178519" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature><wsse:UsernameToken wsu:Id="UsernameToken-38"><wsse:Username>[email protected]</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">yourPassword</wsse:Password></wsse:UsernameToken><wsu:Timestamp wsu:Id="TS-37"><wsu:Created>2013-10-21T14:34:01Z</wsu:Created><wsu:Expires>2013-10-21T14:34:31Z</wsu:Expires></wsu:Timestamp></wsse:Security>
      <idp:IDP wsu:Id="id-40" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <ServiceUserMUID>yourMOHID</ServiceUserMUID>
      </idp:IDP>
      <ebs:EBS wsu:Id="id-39" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <SoftwareConformanceKey>YOUR-CONFORMANCE-KEY</SoftwareConformanceKey>
         <AuditId>XXXXXX-XXXXX-XXXXX-XXXXX-XXXXXXXXX</AuditId>
      </ebs:EBS>
   </soapenv:Header>
   <soapenv:Body wsu:Id="id-41" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <edt:upload>
         <!--1 to 5 repetitions:-->
            <upload>
                <content><inc:Include href="cid:Claim_File_1.txt" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></content>
                <!--Optional:-->
            <description>Claim File1</description>
            <resourceType>CL</resourceType>
            </upload>
            <upload>
                <content><inc:Include href="cid:Claim_File_2.txt" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></content>
                <!--Optional:-->
            <description>Claim File2</description>
            <resourceType>CL</resourceType>
            </upload>   
            <upload>
                <content><inc:Include href="cid:Claim_File_3.txt" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></content>
                <!--Optional:-->
            <description>Claim File3</description>
            <resourceType>CL</resourceType>
            </upload>
            <upload>
                <content><inc:Include href="cid:Claim_File_4.txt" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></content>
                <!--Optional:-->
            <description>Claim File4</description>
            <resourceType>CL</resourceType>
            </upload>
            <upload>
                <content><inc:Include href="cid:Claim_File_5.txt" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></content>
                <!--Optional:-->
            <description>Claim File5</description>
            <resourceType>CL</resourceType>
            </upload>

      </edt:upload>
   </soapenv:Body>
</soapenv:Envelope>
------=_Part_6_26603773.1382366041821
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-ID: <Claim_File_1.txt>
Content-Disposition: attachment; name="Claim_File_1.txt"

HEBV03J201203310005      BGAA17033200                                          
HEH8030482940NN19600527 EDT2P1 HCPP      110020110907     3821                 
HETK028A  0062750120110907616                                                  
HETC003A  0077200120110907780                                                  
HEH5504423178  19811020 EDT2P2 HCPP      110020110907     3821                 
HETA007A  0032350120110907706                                                  
HETC003A  0077200120110907780                                             

我不確定要放入什麼內容作為正文以及是否使用 Form POST 還是僅使用 POST。

我是否只是將上面的原始文字放入正文中?我是否需要將一些內容放入 HTTP 標頭中,或者可以將標頭列在正文中嗎?

答案1

以下是我使用最新版本(3.2.2 打包應用程式)來建立它的方法。

  1. 使用該POST方法並輸入 URL。
  2. 在「標題」標籤上,輸入Content-TypeSOAPActionMIME-Version標題和值。 標題選項卡
  3. 在「正文」標籤上,選擇「原始」單選按鈕,然後將標題後面的空白行後面的所有內容貼User-Agent到正文文字方塊中: 身體標籤

相關內容