Announcement

Collapse
No announcement yet.

MTOM-Response mit Attachment (FORCE MTOM)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MTOM-Response mit Attachment (FORCE MTOM)

    Hallo zusammen,

    ich habe einen fertigen Webservice erstellt, der eine Webmethode beinhaltet, die eine Datei an den Client übergibt.
    Entwickelt habe ich den Webservice mit .NET und WSE 3.0, d.h. also, dass ich hierbei u.a. MTOM nutze.

    Nun teste ich den Webservice mit dem Tool soapUI (Freeware-Tool). Hierbei kann ich Requests auf die Webmethoden absetzen und diese Requests mit bestimmten Eigenschaften definieren.

    Zu meiner Methode...
    Wenn ich die Eigenschaft "force MTOM" in soapUI auf false setze, erhalte ich die Datei als base64-String in meiner Message zurück. So sieht die Anfrage und Antwort aus (RAW-Daten):

    1.1 Anfrage mit FORCE MTOM = FALSE (RAW-DATEN)

    POST http://192.168.100.10/blabla/Service.asmx HTTP/1.1
    Accept-Encoding: gzip,deflate
    Content-Type: text/xml;charset=UTF-8
    SOAPAction: "http://blabla.de/2009/ws/blabla/GetFile"
    User-Agent: Jakarta Commons-HttpClient/3.1
    Host: 192.168.100.10
    Content-Length: 1036

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:win="http://blabla.de/2009/ws/blabla">
    <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">
    <wsse:UsernameToken wsu:Id="UsernameToken-12038460" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>BlaBlaBla</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">BlaBlaBla</wsse:Password>
    <wsse:Nonce>LUhSm+J6lwB1JgWwVI8TKw==</wsse:Nonce>
    <wsu:Created>2009-09-01T12:49:59.796Z</wsu:Created>
    </wsse:UsernameToken>
    </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
    <win:GetFile>
    <!--Optional:-->
    <win:filename>\BlaBla.pdf</win:filename>
    </win:GetFile>
    </soapenv:Body>
    </soapenv:Envelope>

    1.2 Antwort mit FORCE MTOM = FALSE (RAW-DATEN)

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 01 Sep 2009 12:53:25 GMT
    X-AspNet-Version: 2.0.50727
    Cache-Control: private, max-age=0
    Content-Type: text/xml; charset=utf-8
    Content-Length: 97312

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 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">
    <soap:Header>
    <wsa:Action>http://blabla.de/2009/ws/blabla/GetFileResponse</wsa:Action>
    <wsa:MessageID>urn:uuid:8c940cb0-e19d-4517-87c0-a60ffdbe68e4</wsa:MessageID>
    <wsa:RelatesTo>urn:uuid:247f8941-23bc-43d7-8c04-bf0385792c45</wsa:RelatesTo>
    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
    <wsse:Security>
    <wsu:Timestamp wsu:Id="Timestamp-01fc97f1-b8f7-444e-b455-e35780ffe267">
    <wsu:Created>2009-09-01T12:53:25Z</wsu:Created>
    <wsu:Expires>2009-09-01T12:58:25Z</wsu:Expires>
    </wsu:Timestamp>
    </wsse:Security>
    </soap:Header>
    <soap:Body>
    <GetFileResponse xmlns="http://blabla.de/2009/ws/blabla">
    <GetFileResult> ... BASE 64 -String ...</GetFileResult>
    </GetFileResponse>
    </soap:Body>
    </soap:Envelope>

    Nun setze ich den Request auf die gleiche Webmethode, allerdings setze ich hierbei in den Eigenschaften "FORCE MTOM = TRUE":

    2.1 Anfrage mit FORCE MTOM = TRUE (RAW-DATEN)


    POST http://192.168.100.10/blabla/Service.asmx HTTP/1.1
    Accept-Encoding: gzip,deflate
    SOAPAction: "http://blabla.de/2009/ws/blabla/GetFile"
    Content-Type: multipart/related; type="application/xop+xml"; start="<[email protected]>"; start-info="text/xml"; boundary="----=_Part_168_13919253.1251809966781"
    MIME-Version: 1.0
    User-Agent: Jakarta Commons-HttpClient/3.1
    Host: 192.168.100.10
    Content-Length: 1260


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

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:win="http://blabla.de/2009/ws/blabla">
    <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">
    <wsse:UsernameToken wsu:Id="UsernameToken-2111081" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsse:Username>BlaBla</wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">blabla</wsse:Password>
    <wsse:Nonce>9x/CGsA2yP+fDWG2SqGYbw==</wsse:Nonce>
    <wsu:Created>2009-09-01T12:59:26.765Z</wsu:Created>
    </wsse:UsernameToken>
    </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
    <win:GetFile>
    <!--Optional:-->
    <win:filename>\Test12.pdf</win:filename>
    </win:GetFile>
    </soapenv:Body>
    </soapenv:Envelope>
    ------=_Part_168_13919253.1251809966781--

    2.2 Antwort mit FORCE MTOM = TRUE (RAW-DATEN)


    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Tue, 01 Sep 2009 12:59:26 GMT
    X-AspNet-Version: 2.0.50727
    Cache-Control: private, max-age=0
    Content-Type: multipart/related; type="application/xop+xml"; boundary=--MIMEBoundary633874139668125000; start="<[email protected]>"; start-info="text/xml; charset=utf-8"
    Content-Length: 73754


    ----MIMEBoundary633874139668125000
    content-id: <[email protected]>
    content-type: application/xop+xml; charset=utf-8; type="text/xml; charset=utf-8"
    content-transfer-encoding: binary

    <soap:Envelope xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 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">
    <soap:Header>
    <wsa:Action>http://blabla.de/2009/ws/blabla/GetFileResponse</wsa:Action>
    <wsa:MessageID>urn:uuid:71e65520-0cb9-4421-b6a2-51f0a28f43c7</wsa:MessageID>
    <wsa:RelatesTo>urn:uuid:fb65c7bc-5796-4c4c-9ae8-87231e2a7685</wsa:RelatesTo>
    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
    <wsse:Security>
    <wsu:Timestamp wsu:Id="Timestamp-b6937c5c-d8e9-4767-ae8d-3015234cfe74">
    <wsu:Created>2009-09-01T12:59:26Z</wsu:Created>
    <wsu:Expires>2009-09-01T13:04:26Z</wsu:Expires>
    </wsu:Timestamp>
    </wsse:Security>
    </soap:Header>
    <soap:Body>
    <GetFileResponse xmlns="http://blabla.de/2009/ws/blabla">
    <GetFileResult>
    <xop:Include href="cid:[email protected]"/>
    </GetFileResult>
    </GetFileResponse>
    </soap:Body>
    </soap:Envelope>

    ----MIMEBoundary633874139668125000
    content-id: <[email protected]>
    content-type: application/octet-stream
    content-transfer-encoding: binary

    MTOM-Dateninformationen

    Durch das Setzen der Eigenschaft FORCE MTOM = TRUE habe ich genau mein Resultat erzielt: Die Antwort enthält ein Attachment mit der angegbenen Datei!

    Mein Problem:
    Mit soapUI kann ich diese Eigenschaft wunderbar verändern, allerdings hat mein Kunde einen individuellen Client. Mit diesem Client kann er wohl keine Eigenschaften (Headerinformationen) verändern und somit auch nicht diese Eigenschaft setzen.

    Hilfe! Hilfe! Hilfe!
    Wie kann ich nun den Webservice so konfigurieren, dass die Antwort ein Attachment beinhaltet und kein base64-String!? Muss ich dazu die Webmethode anders definieren oder muss ich in der web.config was verändern? Wie kann ich die zweite Antwort erhalten, auch wenn FORCE MTOM = false ist? Ich suche nun schon länger nach einer Lösung und ich würde mich freuen, wenn ich hier den einen oder andere Tipp erhalte!
Working...
X