C# WSE3.0 client to MTOM-based Java web service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • compurhythms@gmail.com

    C# WSE3.0 client to MTOM-based Java web service

    I'm having an issue calling a java-based web service from a C#/.NET
    2.0 client that uses WSE 3.0. (No WCF)

    There is an operation on the web service that takes a single base64
    encoded parameter that is transported as a MTOM mime part in a
    multipart request.

    The web service provider has sent me a trace of a successful SOAP
    request and I have traced my SOAP request and I do not see any
    differences other than differences in how the namespaces of the SOAP
    request are specified in the envelope. The error I am getting is as
    follows:

    "theFile parameter is required. Send as base64 encoded attachment.
    MTOM preferred"

    Has anyone ever experienced this with MTOM attachments going from .NET
    to java? Below are the examples of the "good" and "bad" requests

    ---
    Here is the trace of the so-called "good" SOAP request:

    ----

    Content-Length: 218899
    Host: testtransaction router.ext.cald oj.net
    User-Agent: Jakarta Commons-HttpClient/3.0.1
    SOAPAction: ""
    Content-Type: multipart/related; type="applicati on/xop+xml";
    start="<rootpar t@soapui.org>"; start-info="text/xml"; boundary="----
    =_Part_62_23371 712.12223795288 22"
    MIME-Version: 1.0

    ------=_Part_62_23371 712.12223795288 22
    Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
    Content-Transfer-Encoding: 8bit
    Content-ID: <rootpart@soapu i.org>

    <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/
    envelope/" xmlns:tran="htt p://test.someorg.or g/">
    <soapenv:Head er/>
    <soapenv:Body >
    <tran:submit>
    <!--Optional:-->
    <theFile><inc:I nclude href="cid:11816 73839581"
    xmlns:inc="http ://www.w3.org/2004/08/xop/include"/></theFile>
    </tran:submit>
    </soapenv:Body>
    </soapenv:Envelop e>

    ------=_Part_62_23371 712.12223795288 22
    Content-Type: application/octet-stream
    Content-Transfer-Encoding: binary
    Content-ID: <118167383958 1>

    < snip... binary data here ..>

    ------------------


    Here is the so-called "bad" request from the c# client

    -----

    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
    Protocol 2.0.50727.1433)
    VsDebuggerCausa lityData: uIDPo4vwo6348U5 GsIQDl228IN4AAA AA6YvZm+bHt0KKt
    +s6fTuk2JhzQ+Xy TZ5Kp2jkPtAAzxQ ACAAA
    SOAPAction: "http://test.someorg.or g/submit"
    Host: 10.100.60.101
    Content-Type: multipart/related; type="applicati on/xop+xml";
    boundary=--MIMEBoundary633 580251872485615 ;
    start="<0.63358 0251872485615@e xample.org>"; start-info="text/xml;
    charset=utf-8"
    Content-Length: 429024
    Expect: 100-continue
    Proxy-Connection: Keep-Alive

    ----MIMEBoundary633 580251872485615
    content-id: <0.633580251872 485615@example. org>
    content-type: application/xop+xml; charset=utf-8; type="text/xml;
    charset=utf-8"
    content-transfer-encoding: binary

    <soap:Envelop e xmlns:xop="http ://www.w3.org/2004/08/xop/include"
    xmlns:soap="htt p://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">
    <soap:Header> </soap:Header>
    <soap:Body>
    <submit xmlns="http://test.someorg.or g/abc">
    <theFile>
    <xop:Include href="cid:
    1.6335802518724 85615@example.o rg" />
    </theFile>
    </submit>
    </soap:Body>
    </soap:Envelope>

    ----MIMEBoundary633 580251872485615
    content-id: <1.633580251872 485615@example. org>
    content-type: application/octet-stream
    content-transfer-encoding: binary

    <snip ... binary here>

  • compurhythms@gmail.com

    #2
    Re: C# WSE3.0 client to MTOM-based Java web service

    On Sep 29, 4:31 pm, compurhyt...@gm ail.com wrote:
    I'm having an issue calling a java-based web service from a C#/.NET
    2.0 client that uses WSE 3.0. (No WCF)
    >
    There is an operation on the web service that takes a single base64
    encoded parameter that is transported as a MTOM mime part in a
    multipart request.
    >
    The web service provider has sent me a trace of a successful SOAP
    request and I have traced my SOAP request and I do not see any
    differences other than differences in how the namespaces of the SOAP
    request are specified in the envelope. The error I am getting is as
    follows:
    >
    "theFile parameter is required. Send as base64 encoded attachment.
    MTOM preferred"
    >
    Has anyone ever experienced this with MTOM attachments going from .NET
    to java? Below are the examples of the "good" and "bad" requests
    >
    ---
    Here is the trace of the so-called "good" SOAP request:
    >
    ----
    >
    Content-Length: 218899
    Host: testtransaction router.ext.cald oj.net
    User-Agent: Jakarta Commons-HttpClient/3.0.1
    SOAPAction: ""
    Content-Type: multipart/related; type="applicati on/xop+xml";
    start="<rootp.. .@soapui.org>"; start-info="text/xml"; boundary="----
    =_Part_62_23371 712.12223795288 22"
    MIME-Version: 1.0
    >
    ------=_Part_62_23371 712.12223795288 22
    Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
    Content-Transfer-Encoding: 8bit
    Content-ID: <rootp...@soapu i.org>
    >
    <soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/
    envelope/" xmlns:tran="htt p://test.someorg.or g/">
    <soapenv:Head er/>
    <soapenv:Body >
    <tran:submit>
    <!--Optional:-->
    <theFile><inc:I nclude href="cid:11816 73839581"
    xmlns:inc="http ://www.w3.org/2004/08/xop/include"/></theFile>
    </tran:submit>
    </soapenv:Body>
    </soapenv:Envelop e>
    >
    ------=_Part_62_23371 712.12223795288 22
    Content-Type: application/octet-stream
    Content-Transfer-Encoding: binary
    Content-ID: <118167383958 1>
    >
    < snip... binary data here ..>
    >
    ------------------
    >
    Here is the so-called "bad" request from the c# client
    >
    -----
    >
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
    Protocol 2.0.50727.1433)
    VsDebuggerCausa lityData: uIDPo4vwo6348U5 GsIQDl228IN4AAA AA6YvZm+bHt0KKt
    +s6fTuk2JhzQ+Xy TZ5Kp2jkPtAAzxQ ACAAA
    SOAPAction: "http://test.someorg.or g/submit"
    Host: 10.100.60.101
    Content-Type: multipart/related; type="applicati on/xop+xml";
    boundary=--MIMEBoundary633 580251872485615 ;
    start="<0.63358 0251872485...@e xample.org>"; start-info="text/xml;
    charset=utf-8"
    Content-Length: 429024
    Expect: 100-continue
    Proxy-Connection: Keep-Alive
    >
    ----MIMEBoundary633 580251872485615
    content-id: <0.633580251872 485...@example. org>
    content-type: application/xop+xml; charset=utf-8; type="text/xml;
    charset=utf-8"
    content-transfer-encoding: binary
    >
    <soap:Envelop e xmlns:xop="http ://www.w3.org/2004/08/xop/include"
    xmlns:soap="htt p://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">
    <soap:Header> </soap:Header>
    <soap:Body>
    <submit xmlns="http://test.someorg.or g/abc">
    <theFile>
    <xop:Include href="cid:
    1.6335802518724 85...@example.o rg" />
    </theFile>
    </submit>
    </soap:Body>
    </soap:Envelope>
    >
    ----MIMEBoundary633 580251872485615
    content-id: <1.633580251872 485...@example. org>
    content-type: application/octet-stream
    content-transfer-encoding: binary
    >
    <snip ... binary here>
    I found the answer for anyone that is interested. In the second
    example, the "xmlns" attribute gets applied to the submit tag and all
    its children, making the java web service think that it is not the
    proper "theFile" tag that it is looking for. I wrote a custom
    SoapFilter/custom policy in c# to tweak the XML before it is sent and
    it solved my problem. If anyone is interested in the code you can
    email me at: mplscpl a t y a h o o d o t c o m

    Mike

    Comment

    Working...