Подтвердить что ты не робот

Клиент Apache CXF для службы Microsoft WCF с возвратом MTOM 400

У меня есть клиент Apache CXF для службы WCF Microsoft, и я пытаюсь отправить файл через MTOM. Тем не менее, я продолжаю получать 400, а ошибка на стороне WCF в соответствии с партнером заключается в том, что есть ошибка создания считывателя MTOM

Я отслеживаю исходящее сообщение, и оно выглядит так:

INFO: Outbound Message
---------------------------
ID: 1
Address: https://someserver.com/ImportService.svc?wsdl
Encoding: UTF-8
Http-Method: POST
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:1d46d7c9-047b-440d-928b-ab8689ab5e6f"; start="<[email protected]>"; start-info="application/soap+xml; action=\"http://tempuri.org/IImportService/UploadFile\""
Headers: {Accept=[*/*], Accept-Encoding=[gzip;q=1.0, identity; q=0.5, *;q=0], Content-Encoding=[gzip]}
Payload: --uuid:1d46d7c9-047b-440d-928b-ab8689ab5e6f
Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml; action=\"http://tempuri.org/IImportService/UploadFile\""
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>

    <?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
        <wsse:Security 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:mustUnderstand="true">
            <wsse:UsernameToken wsu:Id="UsernameToken-e51a6fdd-5053-4aae-a9fb-363dde7d9e77">
                <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">mypassword</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
        <ns2:letterOptions xmlns="http://schemas.datacontract.org/2004/07/PublicServices.Import" xmlns:ns2="http://tempuri.org/">
            <EnableQBPlanConsolidation>false</EnableQBPlanConsolidation>
            <MASKSSN>true</MASKSSN>
            <SRPrintedNumberofDays>2</SRPrintedNumberofDays>
            <SuppressAllLetters>false</SuppressAllLetters>
            <SuppressNewMemberLoginLetter>false</SuppressNewMemberLoginLetter>
            <SuppressTakeOverLetterForTermed>false</SuppressTakeOverLetterForTermed>
            <SuppressTerminationLetter>false</SuppressTerminationLetter>
        </ns2:letterOptions>
        <ns2:JobQueueType xmlns="http://schemas.datacontract.org/2004/07/PublicServices.Import" xmlns:ns2="http://tempuri.org/">Import</ns2:JobQueueType>
        <Filename xmlns="http://tempuri.org/">testImport.csv</Filename>
        <Action xmlns="http://www.w3.org/2005/08/addressing">http://tempuri.org/IImportService/UploadFile</Action>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:f380e4cc-225f-4b7d-bd46-6b5d607a59ca</MessageID>
        <To xmlns="http://www.w3.org/2005/08/addressing">https://someserver.com/ImportService.svc?wsdl</To>
        <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
        </ReplyTo>
    </soap:Header>
    <soap:Body>
        <FileUploadMessage xmlns="http://tempuri.org/" xmlns:ns2="http://schemas.datacontract.org/2004/07/PublicServices.Import" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
            <FileByteStream>
                <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:[email protected]"/>
            </FileByteStream>
        </FileUploadMessage>
    </soap:Body>
</soap:Envelope>
--uuid:1d46d7c9-047b-440d-928b-ab8689ab5e6f
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>

[VERSION],1.0
[NPM],552652222,1,Basic Client,Basic Client,Bob,Z,Jones,MR,[email protected],402444555,,1234 Some street,,Omaha,NE,68123,,M,T,F,F

--uuid:1d46d7c9-047b-440d-928b-ab8689ab5e6f--

Я нашел много других случаев, когда у других людей была такая же проблема: https://coderanch.com/t/224995/java/Apache-CXF-MTOM-enabled-WCF

Ошибка ошибочного запроса HTTP при запросе контракта на обслуживание WCF

http://mail-archives.apache.org/mod_mbox/cxf-users/201211.mbox/%[email protected].com%3E

Никто из них не смог решить мою проблему. Я пробовал несколько разных версий CXF, и я получаю одну и ту же ошибку со всеми из них.

Это консолидированная версия кода, вызывающего службу:

    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setBindingId(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
    proxyFactory.setServiceClass(IImportService.class);
    proxyFactory.setAddress(proxyEndpoint);
    proxyFactory.getFeatures().add(new WSAddressingFeature());

    IImportService importService = (IImportService) proxyFactory.create();

    Client client = (Client) importService;

    LetterOptions letterOptions = new LetterOptions();
    letterOptions.setSRPrintedNumberofDays(2);
    letterOptions.setMASKSSN(true);
    letterOptions.setEnableQBPlanConsolidation(false);

    List<Object> headerList = new ArrayList<>();

    headerList.add(new Header(new QName("http://tempuri.org/", "letterOptions"),
            letterOptions, new JAXBDataBinding(LetterOptions.class)));
    headerList.add(new Header(new QName("http://tempuri.org/", "JobQueueType"), JobQueueType.IMPORT, new JAXBDataBinding(JobQueueType.class)));
    headerList.add(new Header(new QName("http://tempuri.org/", "Filename"), "testImport.csv", new JAXBDataBinding(String.class)));

    client.getRequestContext().put(Header.HEADER_LIST, headerList);
    client.getEndpoint().getActiveFeatures().add(new LoggingFeature());

    client.getInInterceptors().add(new GZIPInInterceptor());
    client.getInInterceptors().add(new LogResponseInterceptor());

    GZIPOutInterceptor outInterceptor = new GZIPOutInterceptor();
    outInterceptor.setForce(true);
    client.getOutInterceptors().add(outInterceptor);

    Map props = new HashMap();
    props.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
    props.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
    props.put(WSHandlerConstants.PW_CALLBACK_CLASS, PasswordCallbackHandler.class.getName());
    props.put(WSHandlerConstants.USER, "[email protected]");
    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(props);
    client.getOutInterceptors().add(wssOut);

    HTTPConduit conduit = (HTTPConduit) client.getConduit();
    HTTPClientPolicy policy = conduit.getClient();
    if(policy == null) {
        policy = new HTTPClientPolicy();
    }
    policy.setAllowChunking(false);

    FileUploadMessageReponse response = importService.uploadFile(fileUploadMessage);

Один интересный лакомый кусочек заключается в том, что я могу скопировать тот же запрос, который записывается в SoapUI, и он отлично работает.

4b9b3361