2017-03-02 8 views
0

JBoss Fuse内でコードファーストSOAPサービスを開発しています。私は入力クラスと出力クラスを持つインタフェースmy.endpoint.Interfaceを定義しました。 wsdlが正常に生成され、サービスが動作しています。エンドポイントは私のCamelルートを呼び出すCXFによって処理されます。キャメルルート内のCXF SOAPエンドポイントでXML検証を有効にする

バージョン:
JBossのヒューズ6.2.1
Apacheのキャメル2.15.1
のApache CXF 3.0.4

これは私のバンドルの設定です:

<blueprint> 

    <cxf:cxfEndpoint id="myEndpoint" 
     address="/my/" 
     serviceClass="my.endpoint.Interface"> 
    </cxf:cxfEndpoint> 

    <camelContext> 

     <route> 
      <from uri="cxf:bean:myEndpoint" /> 
      <to uri="bean:doProcess" /> 
     </route> 

    </camelContext> 

</blueprint> 

私はしたいと思いますXSDを使用して着信ペイロードにXML検証を適用します。

この特定の環境でCXFを設定するにはどうすればよいですか?


XSD CxfEndpointConfigurerインターフェイスを指定する場所を私は知りませんでした:青写真ファイルにcxfEndpointの設定

<!-- blueprint file --> 
<from uri="cxf:bean:myEndpoint?cxfEndpointConfigurer=configurer" /> 

// java file 
@Override 
public void configureServer(Server server) { 
    // where do I set XSD in here? 
} 

は、ランタイム

<cxf:cxfEndpoint id="readingsEndpoint" 
       address="/readings/" 
       serviceClass="my.endpoint.Interface"> 
    <cxf:schemaLocations> 
     <schemaLocation>classpath:my/endpoint/schema1.xsd</schemaLocation> 
    </cxf:schemaLocations> 
</cxf:cxfEndpoint> 

で例外が発生します動作しません。次の例外が発生します。

Unable to start blueprint container for bundle my.bundle/0.0.0.SNAPSHOT 
java.lang.NullPointerException 
    at org.apache.aries.blueprint.container.RecipeBuilder.getValue(RecipeBuilder.java:355)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.RecipeBuilder.getValue(RecipeBuilder.java:334)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.RecipeBuilder.createBeanRecipe(RecipeBuilder.java:278)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.RecipeBuilder.createRecipe(RecipeBuilder.java:110)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.RecipeBuilder.createRepository(RecipeBuilder.java:93)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.getRepository(BlueprintContainerImpl.java:481)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:328)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)[23:org.apache.aries.blueprint.core:1.4.4] 
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[17:org.apache.aries.util:1.1.0] 
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[17:org.apache.aries.util:1.1.0] 
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[17:org.apache.aries.util:1.1.0] 
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[17:org.apache.aries.util:1.1.0] 
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[17:org.apache.aries.util:1.1.0] 
    at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2100)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.Felix.updateBundle(Felix.java:2412)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:994)[org.apache.felix.framework-4.4.1.jar:] 
    at org.apache.karaf.shell.dev.watch.BundleWatcher.run(BundleWatcher.java:120)[43:org.apache.karaf.shell.dev:2.4.0.redhat-621084] 
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_101] 

答えて

0

XSDがWSDLとは別のファイル、つまり別のファイルである場合は、バリデータコンポーネントを使用できます。

<camelContext> 

    <route> 
     <from uri="cxf:bean:myEndpoint" /> 
     <to uri="validator:my/endpoint/schema1.xsd" /> 
     <to uri="bean:doProcess" /> 
    </route> 

</camelContext> 

あなたはおそらくもdoTry/doCatchとそれを囲むか、あなたのルートやコンテキストにエラーハンドラを追加する必要があります。

は、実際の石鹸に交換体を設定するには、CXF-エンドポイントを設定するには、次のことができます体を次のように:私の契約-最初のセットアップで

<cxf:cxfEndpoint id="readingsEndpoint" 
      address="/readings/" 
      serviceClass="my.endpoint.Interface"> 
    <cxf:properties> 
     <entry key="dataFormat" value="PAYLOAD"/> 
    </cxf:properties> 
</cxf:cxfEndpoint> 
+0

この時点で、Exchangeの本体はすでにPOJOにアンマーシャリングされています。 CXFに非マーシャル処理を行わせないようにする設定がありますか? –

+0

私は参照してください。はい、dataFormatプロパティを「PAYLOAD」に設定することができます。私は答えを更新します。 – noMad17

1

私はそうのような青写真コンテキストでスキーマ検証を有効にします:

<cxf:cxfEndpoint id="cxfEndpoint" address="http://0.0.0.0:${cxf.port}/${application-path}" serviceClass="my.generated.service.Class" > 
    <cxf:properties> 
     <entry key="schema-validation-enabled" value="true" /> 
    </cxf:properties> 
</cxf:cxfEndpoint> 

これは最初のコードでも有効です。

関連する問題