2017-10-16 3 views
1

Netty 4.0で次のメッセージを受け取ろうとしましたが、プロローグに予期しない文字が残っています。唯一のSOAPエンベロープは、しかし、うまく行くとNettyがmultipart/relatedメッセージを受信すると、予期しない文字がプロローグに表示される - <

Content-Type: multipart/related; boundary="-=Part.0.18fc51f6-a22b-4759-b186-5fa473d479c4=-"; type="text/xml"; start="<0>"; start-info="text/xml" 

---=Part.0.1e843708-4576-408e-be3a-f33185bff722=- 
Content-Type: text/xml; charset=UTF-8 
Content-ID: <0> 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" xmlns:xlink="http://www.w3.org/1999/xlink"> 
    <soap:Header> 
     <eb:MessageHeader eb:version="2.0" soap:mustUnderstand="1"> 
      <eb:From> 
       <eb:PartyId eb:type="urn:osb:oin">00000003273229750000</eb:PartyId> 
       <eb:Role>BevoegdGezag</eb:Role> 
      </eb:From> 
      <eb:To> 
       <eb:PartyId eb:type="urn:osb:oin">00000005123456782000_OTA</eb:PartyId> 
       <eb:Role>LVO</eb:Role> 
      </eb:To> 
      <eb:CPAId>CPAID_ST_OLO_0312_SSL</eb:CPAId> 
      <eb:ConversationId>67643250</eb:ConversationId> 
      <eb:Service eb:type="urn:osb:services">LVO:2:0:0:I</eb:Service> 
      <eb:Action>Fo01</eb:Action> 
      <eb:MessageData> 
       <eb:MessageId>[email protected]</eb:MessageId> 
       <eb:Timestamp>2017-10-14T07:54:08Z</eb:Timestamp> 
       <eb:TimeToLive>2017-10-15T10:54:09Z</eb:TimeToLive> 
      </eb:MessageData> 
      <eb:DuplicateElimination/> 
     </eb:MessageHeader> 
     <eb:AckRequested eb:signed="false" eb:version="2.0" soap:actor="urn:oasis:names:tc:ebxml-msg:actor:toPartyMSH" soap:mustUnderstand="1"/> 
    </soap:Header> 
    <soap:Body> 
     <eb:Manifest eb:version="2.0"> 
      <eb:Reference xlink:href="cid:1" xlink:type="simple"/> 
     </eb:Manifest> 
    </soap:Body> 
</soap:Envelope> 
---=Part.0.1e843708-4576-408e-be3a-f33185bff722=- 
Content-Type: text/xml 
Content-Transfer-Encoding: binary 
Content-ID: <1> 

<StUF:Fo01Bericht xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:BG="http://www.egem.nl/StUF/sector/bg/0310" xmlns:LVO="http://www.egem.nl/StUF/sector/lvo/0311" xmlns:smil20="http://www.w3.org/2001/SMIL20/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:ZKN="http://www.egem.nl/StUF/sector/zkn/0310" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language" xsi:schemaLocation="http://www.egem.nl/StUF/StUF0301 lvo0311msg.xsd"> 
     <StUF:stuurgegevens> 
      <StUF:berichtcode>Fo01</StUF:berichtcode> 
      <StUF:zender> 
       <StUF:applicatie>SquitXO</StUF:applicatie> 
      </StUF:zender> 
      <StUF:ontvanger> 
       <StUF:applicatie>OLO</StUF:applicatie> 
      </StUF:ontvanger> 
      <StUF:referentienummer>67643250</StUF:referentienummer> 
      <StUF:tijdstipBericht>2017101409540300</StUF:tijdstipBericht> 
      <StUF:crossRefnummer>456</StUF:crossRefnummer> 
     </StUF:stuurgegevens> 
     <StUF:body> 
      <StUF:code>code0</StUF:code> 
      <StUF:plek>client</StUF:plek> 
      <StUF:omschrijving>omschrijving0</StUF:omschrijving> 
     </StUF:body> 
     </StUF:Fo01Bericht> 
---=Part.0.1e843708-4576-408e-be3a-f33185bff722=--- 

メッセージを次のように

メッセージです。

設定はこれまでのようになりました。

マルチパートメッセージが機能するために、私は何かがHttpPostRequestDecoderで行われる必要があるが、私はでこれをフィットする方法を見つけることができません理解しています。

HttpPostRequestDecoderは喜んでHttpRequestDecoder/HttpObjectAggregatorと一緒になっていないようです

public void initChannel(SocketChannel ch) { 
    ChannelPipeline p = ch.pipeline(); 

    if (sslCtx != null) { 
     p.addLast(sslCtx.newHandler(ch.alloc())); 
    } 

    p.addLast(new HttpRequestDecoder()); 
    p.addLast(new HttpObjectAggregator(4*1024*1024)); 

    p.addLast(new HttpResponseEncoder()); 

    if(isCompressionDesired) { 
     p.addLast(new HttpContentCompressor(7)); 
    } 

    p.addLast("idleStateHandler", new IdleStateHandler(0, 0, 60)); 

    if(isAdmin) { 
     p.addLast(new SnappyMockServerAdminHandler()); 
    } 
    else { 
     p.addLast(new SnappyMockServerSimpleHandler()); 
    } 
} 

彼らはお互いに矛盾しているように見えるからです。

これを行う方法はありますか?彼らは互いに矛盾するように見えるので、

答えて

0

HttpPostRequestDecoderは喜んでHttpRequestDecoder/HttpObjectAggregatorと一緒になっていないようです。 HttpPostRequestDecoderを使用しているとき、あなたがしたくないものです単一FullHttpRequestに右HttpObjectAggregator集合A HttpMessageとそのすべてのHttpContentsだ

。 (Here is an example from netty's github on how to use the HttpPostRequestDecoder

このような何かを行うことでそれが動作するはずです:

public void initChannel(Channel channel) { 
    ChannelPipeline pipeline = channel.pipeline(); 

    if (sslCtx != null) 
     pipeline.addLast(sslCtx.newHandler(ch.alloc())); 

    pipeline.addLast(new HttpServerCodec()); 

    if(isCompressionDesired) 
     pipeline.addLast(new HttpContentCompressor(7)); 

    pipeline.addLast("idleStateHandler", new IdleStateHandler(0, 0, 60)) 
     .addLast(isAdmin ? new SnappyMockServerAdminHandler() : new SnappyMockServerSimpleHandler()); 
} 
関連する問題