Apache CXF wsdl2java実行可能ファイル(2.7.8と3.2.0バージョンを試しました)でWebサービスのJavaソースを生成しようとしています。Apache CXF wsdl2java InternalError:未解決の参照
私のWSDLファイルは、外部機関(TMDD)から来たので、私は、ファイルを最初に生成しようとしたとき、私はよく
を生成していると仮定し、「非ユニークなボディパーツ」エラーが発生します。org.apache.cxf.tools.common.ToolException: Non-unique body parts! In a port, operations must have unique operation signatures on the wire for successful dispatching. In port {http://www.tmdd.org/303/dialogs}tmddOCSoapHttpServicePort, operations "{http://www.tmdd.org/303/dialogs}dlVideoSwitchStatusRequest" and "{http://www.tmdd.org/303/dialogs}dlIntersectionSignalStatusRequest" have the same request body block {http://www.tmdd.org/303/messages}deviceInformationRequestMsg
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.validate(WSDLToJavaContainer.java:735)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:276)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:185)
これを回避するために、dlVideoSwitchStatusRequest操作で新しい入力メッセージタイプを作成して解決しました。私の手順は以下の通りであった。
新しいメッセージ・タイプを作成します
<message name="MSG_VideoSwitchStatusRequest"> <part name="message" element="tmdd:videoSwitchStatusRequestMsg"/> </message>
は、この一方が他方のための同様のものとして
.xsd
ファイルに定義されているvideoSwitchStatusRequestMsg<xs:element name="videoSwitchStatusRequestMsg" type="VideoSwitchStatusRequest"> <xs:annotation> <xs:documentation> <objectClass>VideoSwitch</objectClass> <requirement>REQ1109</requirement> </xs:documentation> </xs:annotation> </xs:element>
を宣言しますオペレーション。
-
これにより<operation name="dlVideoSwitchStatusRequest"> <documentation><objectClass>VideoSwitch</objectClass><objectClass>ExternalCenter</objectClass><objectClass>OwnerCenter</objectClass><msgPattern>R-R</msgPattern><requirement>REQ538</requirement></documentation> <input message="tns:MSG_VideoSwitchStatusRequest"/> <!-- This is the new type --> <!--<input message="tns:MSG_DeviceInformationRequest"/> This is the old one --> <output message="tns:MSG_VideoSwitchStatus"/> <fault name="errorReport" message="tns:MSG_ErrorReport"/> </operation>
は、そのエラーが解決されたその操作(と思う)のための入力タイプを変更し、今は
Exception in thread "main" java.lang.InternalError: unresolved reference
at com.sun.xml.xsom.impl.parser.DelayedRef._get(DelayedRef.java:103)
at com.sun.xml.xsom.impl.parser.DelayedRef$Type.getType(DelayedRef.java:148)
at com.sun.xml.xsom.impl.ElementDecl.getType(ElementDecl.java:110)
at com.sun.xml.xsom.impl.ElementDecl.updateSubstitutabilityMap(ElementDecl.java:174)
at com.sun.xml.xsom.impl.parser.ParserContext.getResult(ParserContext.java:141)
at com.sun.xml.xsom.parser.XSOMParser.getResult(XSOMParser.java:214)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:538)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:459)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:723)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:267)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:185)
はこの1つは別のエラーを取得しますあまりにも一般的で、私はApacheのサイトから情報やドキュメントを見つけられませんでした。